Computes and returns the logarithm of a number num>0 to the base base≥1. Results are rounded down. Passing a non-positive num value or a base less than 1 throws an error with exit code 5: Integer out of expected range.
Computes and returns the exponentiation involving two numbers: the base and the exponent (or power) exp. Exponent exp must be non-negative, otherwise an error with exit code 5 will be thrown: Integer out of expected range.
Note, that this function works both at run-time and at compile-time.
Usage example:
pow2
Similar to pow(), but sets the base to 2. Works both at run-time and at compile-time.
Usage examples:
checkSignature
Checks the Ed25519signature of the 256-bit unsigned Inthash using a public_key, represented by a 256-bit unsigned Int too. The signature must contain at least 512 bits of data, but only the first 512 bits are used.
Returns true if the signature is valid, false otherwise.
Usage example:
checkDataSignature
Checks the Ed25519signature of the data using a public_key, similar to checkSignature(). If the bit length of data is not divisible by 8, this functions throws an error with exit code 9: Cell underflow. Verification itself is being done indirectly: on a SHA-256 hash of the data.
Returns true if the signature is valid, false otherwise.
Usage example:
sha256
Computes and returns the SHA-256 hash as an 256-bit unsigned Int from a passed Slice or Stringdata.
In case data is a String it should have a number of bits divisible by 8, and in case it’s a Slice it must also have no references (i.e. only up to 1023 bits of data in total).
This function tries to resolve constant string values in compile-time whenever possible.