diff --git a/core/crypto/blake2b/blake2b.odin b/core/crypto/blake2b/blake2b.odin index 2ac5688d5..da5e1ce24 100644 --- a/core/crypto/blake2b/blake2b.odin +++ b/core/crypto/blake2b/blake2b.odin @@ -71,21 +71,21 @@ hash_string :: proc(data: string) -> [64]byte { // hash_bytes will hash the given input and return the // computed hash hash_bytes :: proc(data: []byte) -> [64]byte { - _create_blake2_ctx() + _create_blake2b_ctx() return _hash_impl->hash_bytes_64(data) } // hash_stream will read the stream in chunks and compute a // hash from its contents hash_stream :: proc(s: io.Stream) -> ([64]byte, bool) { - _create_blake2_ctx() + _create_blake2b_ctx() return _hash_impl->hash_stream_64(s) } // hash_file will read the file provided by the given handle // and compute a hash hash_file :: proc(hd: os.Handle, load_at_once := false) -> ([64]byte, bool) { - _create_blake2_ctx() + _create_blake2b_ctx() return _hash_impl->hash_file_64(hd, load_at_once) } @@ -154,7 +154,7 @@ hash_file_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context, hd: os.Handle, loa } @(private) -_create_blake2_ctx :: #force_inline proc() { +_create_blake2b_ctx :: #force_inline proc() { ctx: _blake2.Blake2b_Context cfg: _blake2.Blake2_Config cfg.size = _blake2.BLAKE2B_SIZE @@ -165,7 +165,7 @@ _create_blake2_ctx :: #force_inline proc() { @(private) _init_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context) { - _create_blake2_ctx() + _create_blake2b_ctx() if c, ok := ctx.internal_ctx.(_blake2.Blake2b_Context); ok { _blake2.init_odin(&c) } diff --git a/core/crypto/blake2s/blake2s.odin b/core/crypto/blake2s/blake2s.odin index e219d8346..b47a0bf90 100644 --- a/core/crypto/blake2s/blake2s.odin +++ b/core/crypto/blake2s/blake2s.odin @@ -71,21 +71,21 @@ hash_string :: proc(data: string) -> [32]byte { // hash_bytes will hash the given input and return the // computed hash hash_bytes :: proc(data: []byte) -> [32]byte { - _create_blake2_ctx() + _create_blake2s_ctx() return _hash_impl->hash_bytes_32(data) } // hash_stream will read the stream in chunks and compute a // hash from its contents hash_stream :: proc(s: io.Stream) -> ([32]byte, bool) { - _create_blake2_ctx() + _create_blake2s_ctx() return _hash_impl->hash_stream_32(s) } // hash_file will read the file provided by the given handle // and compute a hash hash_file :: proc(hd: os.Handle, load_at_once := false) -> ([32]byte, bool) { - _create_blake2_ctx() + _create_blake2s_ctx() return _hash_impl->hash_file_32(hd, load_at_once) } @@ -154,7 +154,7 @@ hash_file_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context, hd: os.Handle, loa } @(private) -_create_blake2_ctx :: #force_inline proc() { +_create_blake2s_ctx :: #force_inline proc() { ctx: _blake2.Blake2s_Context cfg: _blake2.Blake2_Config cfg.size = _blake2.BLAKE2S_SIZE @@ -165,7 +165,7 @@ _create_blake2_ctx :: #force_inline proc() { @(private) _init_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context) { - _create_blake2_ctx() + _create_blake2s_ctx() if c, ok := ctx.internal_ctx.(_blake2.Blake2s_Context); ok { _blake2.init_odin(&c) } diff --git a/core/crypto/keccak/keccak.odin b/core/crypto/keccak/keccak.odin index 37aa7c12e..4b3f9a5a2 100644 --- a/core/crypto/keccak/keccak.odin +++ b/core/crypto/keccak/keccak.odin @@ -80,21 +80,21 @@ hash_string_224 :: proc(data: string) -> [28]byte { // hash_bytes_224 will hash the given input and return the // computed hash hash_bytes_224 :: proc(data: []byte) -> [28]byte { - _create_sha3_ctx(28) + _create_keccak_ctx(28) return _hash_impl->hash_bytes_28(data) } // hash_stream_224 will read the stream in chunks and compute a // hash from its contents hash_stream_224 :: proc(s: io.Stream) -> ([28]byte, bool) { - _create_sha3_ctx(28) + _create_keccak_ctx(28) return _hash_impl->hash_stream_28(s) } // hash_file_224 will read the file provided by the given handle // and compute a hash hash_file_224 :: proc(hd: os.Handle, load_at_once := false) -> ([28]byte, bool) { - _create_sha3_ctx(28) + _create_keccak_ctx(28) return _hash_impl->hash_file_28(hd, load_at_once) } @@ -114,21 +114,21 @@ hash_string_256 :: proc(data: string) -> [32]byte { // hash_bytes_256 will hash the given input and return the // computed hash hash_bytes_256 :: proc(data: []byte) -> [32]byte { - _create_sha3_ctx(32) + _create_keccak_ctx(32) return _hash_impl->hash_bytes_32(data) } // hash_stream_256 will read the stream in chunks and compute a // hash from its contents hash_stream_256 :: proc(s: io.Stream) -> ([32]byte, bool) { - _create_sha3_ctx(32) + _create_keccak_ctx(32) return _hash_impl->hash_stream_32(s) } // hash_file_256 will read the file provided by the given handle // and compute a hash hash_file_256 :: proc(hd: os.Handle, load_at_once := false) -> ([32]byte, bool) { - _create_sha3_ctx(32) + _create_keccak_ctx(32) return _hash_impl->hash_file_32(hd, load_at_once) } @@ -148,21 +148,21 @@ hash_string_384 :: proc(data: string) -> [48]byte { // hash_bytes_384 will hash the given input and return the // computed hash hash_bytes_384 :: proc(data: []byte) -> [48]byte { - _create_sha3_ctx(48) + _create_keccak_ctx(48) return _hash_impl->hash_bytes_48(data) } // hash_stream_384 will read the stream in chunks and compute a // hash from its contents hash_stream_384 :: proc(s: io.Stream) -> ([48]byte, bool) { - _create_sha3_ctx(48) + _create_keccak_ctx(48) return _hash_impl->hash_stream_48(s) } // hash_file_384 will read the file provided by the given handle // and compute a hash hash_file_384 :: proc(hd: os.Handle, load_at_once := false) -> ([48]byte, bool) { - _create_sha3_ctx(48) + _create_keccak_ctx(48) return _hash_impl->hash_file_48(hd, load_at_once) } @@ -182,21 +182,21 @@ hash_string_512 :: proc(data: string) -> [64]byte { // hash_bytes_512 will hash the given input and return the // computed hash hash_bytes_512 :: proc(data: []byte) -> [64]byte { - _create_sha3_ctx(64) + _create_keccak_ctx(64) return _hash_impl->hash_bytes_64(data) } // hash_stream_512 will read the stream in chunks and compute a // hash from its contents hash_stream_512 :: proc(s: io.Stream) -> ([64]byte, bool) { - _create_sha3_ctx(64) + _create_keccak_ctx(64) return _hash_impl->hash_stream_64(s) } // hash_file_512 will read the file provided by the given handle // and compute a hash hash_file_512 :: proc(hd: os.Handle, load_at_once := false) -> ([64]byte, bool) { - _create_sha3_ctx(64) + _create_keccak_ctx(64) return _hash_impl->hash_file_64(hd, load_at_once) } @@ -388,7 +388,7 @@ hash_file_odin_64 :: #force_inline proc(ctx: ^_ctx.Hash_Context, hd: os.Handle, } @(private) -_create_sha3_ctx :: #force_inline proc(mdlen: int) { +_create_keccak_ctx :: #force_inline proc(mdlen: int) { ctx: _sha3.Sha3_Context ctx.mdlen = mdlen ctx.is_keccak = true @@ -404,10 +404,10 @@ _create_sha3_ctx :: #force_inline proc(mdlen: int) { @(private) _init_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context) { #partial switch ctx.hash_size { - case ._28: _create_sha3_ctx(28) - case ._32: _create_sha3_ctx(32) - case ._48: _create_sha3_ctx(48) - case ._64: _create_sha3_ctx(64) + case ._28: _create_keccak_ctx(28) + case ._32: _create_keccak_ctx(32) + case ._48: _create_keccak_ctx(48) + case ._64: _create_keccak_ctx(64) } if c, ok := ctx.internal_ctx.(_sha3.Sha3_Context); ok { _sha3.init_odin(&c) diff --git a/core/crypto/shake/shake.odin b/core/crypto/shake/shake.odin index 44dd3d40d..2822dace2 100644 --- a/core/crypto/shake/shake.odin +++ b/core/crypto/shake/shake.odin @@ -74,21 +74,21 @@ hash_string_128 :: proc(data: string) -> [16]byte { // hash_bytes_128 will hash the given input and return the // computed hash hash_bytes_128 :: proc(data: []byte) -> [16]byte { - _create_sha3_ctx(16) + _create_shake_ctx(16) return _hash_impl->hash_bytes_16(data) } // hash_stream_128 will read the stream in chunks and compute a // hash from its contents hash_stream_128 :: proc(s: io.Stream) -> ([16]byte, bool) { - _create_sha3_ctx(16) + _create_shake_ctx(16) return _hash_impl->hash_stream_16(s) } // hash_file_128 will read the file provided by the given handle // and compute a hash hash_file_128 :: proc(hd: os.Handle, load_at_once := false) -> ([16]byte, bool) { - _create_sha3_ctx(16) + _create_shake_ctx(16) return _hash_impl->hash_file_16(hd, load_at_once) } @@ -108,21 +108,21 @@ hash_string_256 :: proc(data: string) -> [32]byte { // hash_bytes_256 will hash the given input and return the // computed hash hash_bytes_256 :: proc(data: []byte) -> [32]byte { - _create_sha3_ctx(32) + _create_shake_ctx(32) return _hash_impl->hash_bytes_32(data) } // hash_stream_256 will read the stream in chunks and compute a // hash from its contents hash_stream_256 :: proc(s: io.Stream) -> ([32]byte, bool) { - _create_sha3_ctx(32) + _create_shake_ctx(32) return _hash_impl->hash_stream_32(s) } // hash_file_256 will read the file provided by the given handle // and compute a hash hash_file_256 :: proc(hd: os.Handle, load_at_once := false) -> ([32]byte, bool) { - _create_sha3_ctx(32) + _create_shake_ctx(32) return _hash_impl->hash_file_32(hd, load_at_once) } @@ -236,7 +236,7 @@ hash_file_odin_32 :: #force_inline proc(ctx: ^_ctx.Hash_Context, hd: os.Handle, } @(private) -_create_sha3_ctx :: #force_inline proc(mdlen: int) { +_create_shake_ctx :: #force_inline proc(mdlen: int) { ctx: _sha3.Sha3_Context ctx.mdlen = mdlen _hash_impl.internal_ctx = ctx @@ -249,8 +249,8 @@ _create_sha3_ctx :: #force_inline proc(mdlen: int) { @(private) _init_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context) { #partial switch ctx.hash_size { - case ._16: _create_sha3_ctx(16) - case ._32: _create_sha3_ctx(32) + case ._16: _create_shake_ctx(16) + case ._32: _create_shake_ctx(32) } if c, ok := ctx.internal_ctx.(_sha3.Sha3_Context); ok { _sha3.init_odin(&c) diff --git a/core/crypto/tiger/tiger.odin b/core/crypto/tiger/tiger.odin index 24c6c2e6f..240375b90 100644 --- a/core/crypto/tiger/tiger.odin +++ b/core/crypto/tiger/tiger.odin @@ -76,21 +76,21 @@ hash_string_128 :: proc(data: string) -> [16]byte { // hash_bytes_128 will hash the given input and return the // computed hash hash_bytes_128 :: proc(data: []byte) -> [16]byte { - _create_ripemd_ctx(16) + _create_tiger_ctx(16) return _hash_impl->hash_bytes_16(data) } // hash_stream_128 will read the stream in chunks and compute a // hash from its contents hash_stream_128 :: proc(s: io.Stream) -> ([16]byte, bool) { - _create_ripemd_ctx(16) + _create_tiger_ctx(16) return _hash_impl->hash_stream_16(s) } // hash_file_128 will read the file provided by the given handle // and compute a hash hash_file_128 :: proc(hd: os.Handle, load_at_once := false) -> ([16]byte, bool) { - _create_ripemd_ctx(16) + _create_tiger_ctx(16) return _hash_impl->hash_file_16(hd, load_at_once) } @@ -110,21 +110,21 @@ hash_string_160 :: proc(data: string) -> [20]byte { // hash_bytes_160 will hash the given input and return the // computed hash hash_bytes_160 :: proc(data: []byte) -> [20]byte { - _create_ripemd_ctx(20) + _create_tiger_ctx(20) return _hash_impl->hash_bytes_20(data) } // hash_stream_160 will read the stream in chunks and compute a // hash from its contents hash_stream_160 :: proc(s: io.Stream) -> ([20]byte, bool) { - _create_ripemd_ctx(20) + _create_tiger_ctx(20) return _hash_impl->hash_stream_20(s) } // hash_file_160 will read the file provided by the given handle // and compute a hash hash_file_160 :: proc(hd: os.Handle, load_at_once := false) -> ([20]byte, bool) { - _create_ripemd_ctx(20) + _create_tiger_ctx(20) return _hash_impl->hash_file_20(hd, load_at_once) } @@ -144,21 +144,21 @@ hash_string_192 :: proc(data: string) -> [24]byte { // hash_bytes_192 will hash the given input and return the // computed hash hash_bytes_192 :: proc(data: []byte) -> [24]byte { - _create_ripemd_ctx(24) + _create_tiger_ctx(24) return _hash_impl->hash_bytes_24(data) } // hash_stream_192 will read the stream in chunks and compute a // hash from its contents hash_stream_192 :: proc(s: io.Stream) -> ([24]byte, bool) { - _create_ripemd_ctx(24) + _create_tiger_ctx(24) return _hash_impl->hash_stream_24(s) } // hash_file_192 will read the file provided by the given handle // and compute a hash hash_file_192 :: proc(hd: os.Handle, load_at_once := false) -> ([24]byte, bool) { - _create_ripemd_ctx(24) + _create_tiger_ctx(24) return _hash_impl->hash_file_24(hd, load_at_once) } @@ -293,7 +293,7 @@ hash_file_odin_24 :: #force_inline proc(ctx: ^_ctx.Hash_Context, hd: os.Handle, } @(private) -_create_ripemd_ctx :: #force_inline proc(hash_size: int) { +_create_tiger_ctx :: #force_inline proc(hash_size: int) { ctx: _tiger.Tiger_Context ctx.ver = 1 _hash_impl.internal_ctx = ctx @@ -307,9 +307,9 @@ _create_ripemd_ctx :: #force_inline proc(hash_size: int) { @(private) _init_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context) { #partial switch ctx.hash_size { - case ._16: _create_ripemd_ctx(16) - case ._20: _create_ripemd_ctx(20) - case ._24: _create_ripemd_ctx(24) + case ._16: _create_tiger_ctx(16) + case ._20: _create_tiger_ctx(20) + case ._24: _create_tiger_ctx(24) } if c, ok := ctx.internal_ctx.(_tiger.Tiger_Context); ok { _tiger.init_odin(&c) diff --git a/core/crypto/tiger2/tiger2.odin b/core/crypto/tiger2/tiger2.odin index b7fc301ed..a61d271ad 100644 --- a/core/crypto/tiger2/tiger2.odin +++ b/core/crypto/tiger2/tiger2.odin @@ -76,21 +76,21 @@ hash_string_128 :: proc(data: string) -> [16]byte { // hash_bytes_128 will hash the given input and return the // computed hash hash_bytes_128 :: proc(data: []byte) -> [16]byte { - _create_ripemd_ctx(16) + _create_tiger2_ctx(16) return _hash_impl->hash_bytes_16(data) } // hash_stream_128 will read the stream in chunks and compute a // hash from its contents hash_stream_128 :: proc(s: io.Stream) -> ([16]byte, bool) { - _create_ripemd_ctx(16) + _create_tiger2_ctx(16) return _hash_impl->hash_stream_16(s) } // hash_file_128 will read the file provided by the given handle // and compute a hash hash_file_128 :: proc(hd: os.Handle, load_at_once := false) -> ([16]byte, bool) { - _create_ripemd_ctx(16) + _create_tiger2_ctx(16) return _hash_impl->hash_file_16(hd, load_at_once) } @@ -110,21 +110,21 @@ hash_string_160 :: proc(data: string) -> [20]byte { // hash_bytes_160 will hash the given input and return the // computed hash hash_bytes_160 :: proc(data: []byte) -> [20]byte { - _create_ripemd_ctx(20) + _create_tiger2_ctx(20) return _hash_impl->hash_bytes_20(data) } // hash_stream_160 will read the stream in chunks and compute a // hash from its contents hash_stream_160 :: proc(s: io.Stream) -> ([20]byte, bool) { - _create_ripemd_ctx(20) + _create_tiger2_ctx(20) return _hash_impl->hash_stream_20(s) } // hash_file_160 will read the file provided by the given handle // and compute a hash hash_file_160 :: proc(hd: os.Handle, load_at_once := false) -> ([20]byte, bool) { - _create_ripemd_ctx(20) + _create_tiger2_ctx(20) return _hash_impl->hash_file_20(hd, load_at_once) } @@ -144,21 +144,21 @@ hash_string_192 :: proc(data: string) -> [24]byte { // hash_bytes_192 will hash the given input and return the // computed hash hash_bytes_192 :: proc(data: []byte) -> [24]byte { - _create_ripemd_ctx(24) + _create_tiger2_ctx(24) return _hash_impl->hash_bytes_24(data) } // hash_stream_192 will read the stream in chunks and compute a // hash from its contents hash_stream_192 :: proc(s: io.Stream) -> ([24]byte, bool) { - _create_ripemd_ctx(24) + _create_tiger2_ctx(24) return _hash_impl->hash_stream_24(s) } // hash_file_192 will read the file provided by the given handle // and compute a hash hash_file_192 :: proc(hd: os.Handle, load_at_once := false) -> ([24]byte, bool) { - _create_ripemd_ctx(24) + _create_tiger2_ctx(24) return _hash_impl->hash_file_24(hd, load_at_once) } @@ -293,7 +293,7 @@ hash_file_odin_24 :: #force_inline proc(ctx: ^_ctx.Hash_Context, hd: os.Handle, } @(private) -_create_ripemd_ctx :: #force_inline proc(hash_size: int) { +_create_tiger2_ctx :: #force_inline proc(hash_size: int) { ctx: _tiger.Tiger_Context ctx.ver = 2 _hash_impl.internal_ctx = ctx @@ -307,9 +307,9 @@ _create_ripemd_ctx :: #force_inline proc(hash_size: int) { @(private) _init_odin :: #force_inline proc(ctx: ^_ctx.Hash_Context) { #partial switch ctx.hash_size { - case ._16: _create_ripemd_ctx(16) - case ._20: _create_ripemd_ctx(20) - case ._24: _create_ripemd_ctx(24) + case ._16: _create_tiger2_ctx(16) + case ._20: _create_tiger2_ctx(20) + case ._24: _create_tiger2_ctx(24) } if c, ok := ctx.internal_ctx.(_tiger.Tiger_Context); ok { _tiger.init_odin(&c)