mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-01 20:28:15 +00:00
core/crypto: Switch to using ensure
This commit is contained in:
@@ -28,9 +28,8 @@ Context :: _blake2.Blake2b_Context
|
||||
|
||||
// init initializes a Context with the default BLAKE2b config.
|
||||
init :: proc(ctx: ^Context, digest_size := DIGEST_SIZE) {
|
||||
if digest_size > 255 {
|
||||
panic("blake2b: invalid digest size")
|
||||
}
|
||||
ensure(digest_size <= _blake2.MAX_SIZE, "crypto/blake2b: invalid digest size")
|
||||
|
||||
cfg: _blake2.Blake2_Config
|
||||
cfg.size = u8(digest_size)
|
||||
_blake2.init(ctx, &cfg)
|
||||
|
||||
Reference in New Issue
Block a user