class Sodium::Digest::Blake2b
- Sodium::Digest::Blake2b
- Digest
- Reference
- Object
Overview
Hash data using Blake2b.
Compatible with the Crystal OpenSSL::Digest interface.
Usage:
digest = Blake2b.new
digest.update data
digest.update data
digest.hexfinal => String
Included Modules
- Sodium::Wipe
Defined in:
sodium/digest/blake2b.crConstant Summary
-
KEY_SIZE =
LibSodium.crypto_generichash_blake2b_keybytes.to_i
-
32
-
KEY_SIZE_MAX =
LibSodium.crypto_generichash_blake2b_keybytes_max.to_i
-
64
-
KEY_SIZE_MIN =
LibSodium.crypto_generichash_blake2b_keybytes_min.to_i
-
16
-
Log =
::Log.for(self)
-
OUT_SIZE =
LibSodium.crypto_generichash_blake2b_bytes.to_i32
-
32
-
OUT_SIZE_MAX =
LibSodium.crypto_generichash_blake2b_bytes_max.to_i32
-
64
-
OUT_SIZE_MIN =
LibSodium.crypto_generichash_blake2b_bytes_min.to_i32
-
16
-
PERSONAL_SIZE =
LibSodium.crypto_generichash_blake2b_personalbytes.to_i
-
16
-
SALT_SIZE =
LibSodium.crypto_generichash_blake2b_saltbytes.to_i
-
16
Constructors
-
.new(digest_size : Int32 = OUT_SIZE, key : Bytes? | SecureBuffer? = nil, salt : Bytes? = nil, personal : Bytes? = nil)
Create a new Blake2b Digest.
Instance Method Summary
- #clone
-
#digest_size : Int32
Returns the digest output size in bytes.
-
#final_impl(dst : Bytes) : Nil
Stores the output digest of #digest_size bytes in dst.
- #hexfinal(dst : Bytes) : Nil
- #hexfinal : String
- #key_size : Int32
-
#reset_impl : Nil
Resets the object to it's initial state.
-
#update_impl(data : Bytes) : Nil
Hashes data incrementally.
Constructor Detail
Create a new Blake2b Digest.
digest_size is selectable. Use 32 for Blake2b256 (libsodium default), 64 for Blake2b512 or any value between OUT_SIZE_MIN and OUT_SIZE_MAX. Many libsodium bindings only support [256] or [256 and 512] bit output.
key
, salt
, and personal
are all optional. Many other libsodium bindings don't support them.
Check the other implementation(s) you need to interoperate with before using.
Instance Method Detail
Returns the digest output size in bytes.
Stores the output digest of #digest_size bytes in dst.
Resets the object to it's initial state.
Hashes data incrementally.