TweetNaClExt extension

TweetNaCl's extension class. Following the TweetNaCl convention and added some extras. Extension is just an eye-candy here as it uses only static methods.

Implemented features:

  • HMAC-SHA512 and HMAC-SHA256
    • crypto_auth_hmacsha512, HMAC-SHA-512
    • crypto_auth_hmacsha256, HMAC-SHA-256
  • Hashing algorithm
    • SHA256
  • Utils
    • crypto_verify_64, verifying function for SHA-512 as an example
  • X25519 conversion utulities
    • crypto_sign_ed25519_sk_to_x25519_sk
    • crypto_sign_ed25519_pk_to_x25519_pk
  • Curve25519 low-level functions
    • crypto_scalar_base, for retrieving different type of public-keys e.g. A = k * B.
    • crypto_point_add, for adding two public keys' point together A = y1 : y2.
on

Static Methods

crypto_auth_hmacsha256(Uint8List out, Uint8List m, Uint8List k) int

Available on TweetNaCl, provided by the TweetNaClExt extension

crypto_auth_hmacsha512(Uint8List out, Uint8List m, Uint8List k) int

Available on TweetNaCl, provided by the TweetNaClExt extension

crypto_hash_sha256(Uint8List out, Uint8List m) Uint8List

Available on TweetNaCl, provided by the TweetNaClExt extension

crypto_point_add(Uint8List out, Uint8List p1, Uint8List p2) int

Available on TweetNaCl, provided by the TweetNaClExt extension

crypto_scalar_base(Uint8List pk, Uint8List sk) int

Available on TweetNaCl, provided by the TweetNaClExt extension

crypto_sign_ed25519_pk_to_x25519_pk(Uint8List x25519_pk, Uint8List ed25519_pk) int

Available on TweetNaCl, provided by the TweetNaClExt extension

Converts Ed25519 public/verifying key to Curve25519 public key. Xmont = (1 + Yed)/(1 - Yed) mod p
crypto_sign_ed25519_sk_to_x25519_sk(Uint8List x25519_sk, Uint8List ed25519_sk) int

Available on TweetNaCl, provided by the TweetNaClExt extension

Converts Ed25519 private/signing key to Curve25519 private key. It's just simply the SHA512 and prone-to-buffered seed.
crypto_verify_64(Uint8List x, Uint8List y) int

Available on TweetNaCl, provided by the TweetNaClExt extension