Constructs a new Blake2b128Task.
Optionalproperties: IBlake2b128TaskProperties to set
Optional value to hash. If not provided or empty, will use the previous task output.
Converts this Blake2b128Task to JSON.
JSON object
StaticcreateCreates a new Blake2b128Task instance using the specified properties.
Optionalproperties: IBlake2b128TaskProperties to set
Blake2b128Task instance
StaticdecodeDecodes a Blake2b128Task message from the specified reader or buffer.
Reader or buffer to decode from
Optionallength: numberMessage length if known beforehand
Blake2b128Task
StaticdecodeDecodes a Blake2b128Task message from the specified reader or buffer, length delimited.
Reader or buffer to decode from
Blake2b128Task
StaticencodeEncodes the specified Blake2b128Task message. Does not implicitly {@apilink oracle_job.OracleJob.Blake2b128Task.verify|verify} messages.
Blake2b128Task message or plain object to encode
Optionalwriter: WriterWriter to encode to
Writer
StaticencodeEncodes the specified Blake2b128Task message, length delimited. Does not implicitly {@apilink oracle_job.OracleJob.Blake2b128Task.verify|verify} messages.
Blake2b128Task message or plain object to encode
Optionalwriter: WriterWriter to encode to
Writer
StaticfromCreates a Blake2b128Task message from a plain object. Also converts values to their respective internal types.
Plain object
Blake2b128Task
StaticgetGets the default type url for Blake2b128Task
OptionaltypeUrlPrefix: stringyour custom typeUrlPrefix(default "type.googleapis.com")
The default type url
StatictoCreates a plain object from a Blake2b128Task message. Also converts values to other types if specified.
Blake2b128Task
Optionaloptions: IConversionOptionsConversion options
Plain object
StaticverifyVerifies a Blake2b128Task message.
Plain object to verify
null if valid, otherwise the reason why it is not
Compute the BLAKE2b-128 hash of the input data and convert it to a numeric Decimal value.
This task follows cryptographic standard hash truncation practices used in:
Input: String data to hash (can be from a previous task's output)
Returns: A positive Decimal number with 18 decimal places (scale 18)
0.000000000000000000to79228162514264.337593543950335(2^96 - 1, scaled)17512223723.299011049621773283Hash-to-Decimal Conversion Algorithm
Step-by-Step Process
1. Compute BLAKE2b-128 hash* (produces 16 bytes / 128 bits)
2. Truncate to 96 bits (12 bytes)* - keep the most significant bits
This follows cryptographic standards where truncation keeps the leftmost/most significant bits.
3. Pad to 16 bytes* for u128 representation
4. Interpret as u128 using big-endian* byte order
Big-endian is the standard for cryptographic hash representations.
5. Convert to Decimal* with scale 18 (18 decimal places)
Scale 18 prevents precision loss when the protocol rescales values. Guaranteed to fit in Decimal's 96-bit mantissa (max: 2^96 - 1).
Reproducibility
To reproduce this conversion in any programming language:
Python Example
JavaScript Example
Rust Example
Why This Approach?
✅ Cryptographic Standard: Follows the same truncation method as SHA-224, BLAKE2s-128, etc. ✅ Preserves Entropy: Keeps the most significant/diverse bits of the hash ✅ Big-Endian: Standard convention for cryptographic hash representations ✅ Fits Decimal Range: 96 bits always fits within Decimal's mantissa (max 2^96-1) ✅ Scale 18: Prevents precision loss when protocol rescales values ✅ Reproducible: Simple algorithm implementable in any programming language ✅ Deterministic: Same input always produces same output
Example: Hash a static string
Example: Hash the output from a previous task (e.g., HTTP response)