class NamedInformation::BinHash
- NamedInformation::BinHash
- BinData
- Reference
- Object
Defined in:
named_information/bin_hash.crConstant Summary
-
AFTER_DESERIALIZE =
[] of Nil
-
BEFORE_SERIALIZE =
[] of Nil
-
ENDIAN =
["network"]
-
KLASS_NAME =
[NamedInformation::BinHash]
-
PARTS =
[{type: "bitfield", name: 0, cls: NamedInformation::BinHash, onlyif: nil, verify: nil}, {type: "bytes", name: hash_value, cls: Slice(UInt8), onlyif: nil, verify: nil, length: -> do bits = ALGORITHM_ID[suite_id.to_s][:truncate] || 256 bits // 8 end, value: nil}] of Nil
-
REMAINING =
[] of Nil
Class Method Summary
Macro Summary
Instance Method Summary
- #__format__ : IO::ByteFormat
- #algorithm
-
#hash
Generates an
UInt64
hash value for this object. - #hash_value : Bytes
- #hash_value=(hash_value : Bytes)
-
#reserved : UInt8
Res field is a reserved 2-bit field for future use
-
#reserved=(reserved : UInt8)
Res field is a reserved 2-bit field for future use
-
#suite_id : UInt8
The hash algorithm and truncation length are specified by the Suite ID
-
#suite_id=(suite_id : UInt8)
The hash algorithm and truncation length are specified by the Suite ID
- #to_hash
- #to_u128 : UInt128
Class Method Detail
Macro Detail
Instance Method Detail
def hash
#
Description copied from class Object
Generates an UInt64
hash value for this object.
This method must have the property that a == b
implies a.hash == b.hash
.
The hash value is used along with ==
by the Hash
class to determine if two objects
reference the same hash key.
Subclasses must not override this method. Instead, they must define hash(hasher)
,
though usually the macro def_hash
can be used to generate this method.
def suite_id=(suite_id : UInt8)
#
The hash algorithm and truncation length are specified by the Suite ID