Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

@@ -0,0 +1,44 @@
// Copyright ©2025 blackshirt.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
//
import encoding.hex
import x.crypto.ascon
// The material was generated from https://hashing.tools/ascon/ascon-hash
fn main() {
msg := 'Example of CXof128 message'.bytes()
cs := 'custom-string-cxof128'.bytes()
// expected output generated from the tool, with 32, 64 dan 75-bytes output
digest32 := hex.decode('d71492b816b1ac27f53f9c13be45c1d2d0530b8dde7fde8d34cb563f79b3d3d3')!
digest64 :=
hex.decode('d71492b816b1ac27f53f9c13be45c1d2d0530b8dde7fde8d34cb563f79b3d3d3601d03474ec6fe1f6b8dc5dd79bea20aff4c95ca3549202b1aaeb9e66b5df398')!
digest75 :=
hex.decode('d71492b816b1ac27f53f9c13be45c1d2d0530b8dde7fde8d34cb563f79b3d3d3601d03474ec6fe1f6b8dc5dd79bea20aff4c95ca3549202b1aaeb9e66b5df3985a88fd8bce0f9570962321')!
out32 := ascon.cxof128(msg, 32, cs)!
out64 := ascon.cxof128(msg, 64, cs)!
out75 := ascon.cxof128(msg, 75, cs)!
dump(out32 == digest32) // out32 == digest32: true
dump(out64 == digest64) // out64 == digest64: true
dump(out75 == digest75) // out75 == digest75: true
// With object based
mut x := ascon.new_cxof128(32, cs)!
s32 := x.sum(msg)
dump(s32 == digest32) // s32 == digest32: true
// with sized output
x.reset()
_ := x.write(msg)!
mut b64 := []u8{len: 64}
_ := x.read(mut b64)!
dump(b64 == digest64) // b64 == digest64: true
x.reset()
_ := x.write(msg)!
mut b75 := []u8{len: 75}
_ := x.read(mut b75)!
dump(b75 == digest75) // b75 == digest75: true
}
@@ -0,0 +1,16 @@
// Copyright ©2025 blackshirt.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
//
import encoding.hex
import x.crypto.ascon
// The material was generated from https://hashing.tools/ascon/ascon-hash
fn main() {
msg := 'Example of hash256 message'.bytes()
// expected output generated from the tool
digest := hex.decode('0889515a9cfe28ab3a43882884d5933bb74aa09f3c767f8c699b5d7114811340')!
out := ascon.sum256(msg)
dump(out == digest) // out == digest: true
}
@@ -0,0 +1,42 @@
// Copyright ©2025 blackshirt.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
//
import encoding.hex
import x.crypto.ascon
// The material was generated from https://hashing.tools/ascon/ascon-hash
fn main() {
msg := 'Example of Xof128 message'.bytes()
// expected output generated from the tool, with 32, 64 dan 75-bytes output
digest32 := hex.decode('424caaf68eb94aa251536bb6b565c0695b8944f932d011b1049df85b7f27d2f3')!
digest64 :=
hex.decode('424caaf68eb94aa251536bb6b565c0695b8944f932d011b1049df85b7f27d2f3bf704643a643c3f2dcfb1e0bc73ec55781b5283966d2d1da85d89794ca5c292e')!
digest75 :=
hex.decode('424caaf68eb94aa251536bb6b565c0695b8944f932d011b1049df85b7f27d2f3bf704643a643c3f2dcfb1e0bc73ec55781b5283966d2d1da85d89794ca5c292e36260815a8f10088e3804c')!
out32 := ascon.xof128(msg, 32)!
out64 := ascon.xof128(msg, 64)!
out75 := ascon.xof128(msg, 75)!
dump(out32 == digest32) // out32 == digest32: true
dump(out64 == digest64) // out64 == digest64: true
dump(out75 == digest75) // out75 == digest75: true
// With object based
mut x := ascon.new_xof128(32)
s32 := x.sum(msg)
dump(s32 == digest32) // s32 == digest32: true
// with sized output
x.reset()
_ := x.write(msg)!
mut b64 := []u8{len: 64}
_ := x.read(mut b64)!
dump(b64 == digest64) // b64 == digest64: true
x.reset()
_ := x.write(msg)!
mut b75 := []u8{len: 75}
_ := x.read(mut b75)!
dump(b75 == digest75) // b75 == digest75: true
}