sodium-native

sodium-native

  • Get Started
  • API
  • Github

›API

Get Started

  • Introduction
  • Projects using sodium-native

API

  • Compatibility
  • API
  • Memory Protection
  • Generating Random Data
  • Helpers
  • Padding
  • Signing
  • Generic Hashing
  • Public/Secret Key Box Encryption
  • Sealed Box Encryption
  • Secret Key Box Encryption
  • AEAD (Authenticated Encryption with Additional Data)
  • Non-Authenticated Streaming Encryption
  • Authentication
  • Stream Encryption
  • One-Time Authentication
  • Password Hashing
  • Key Exchange
  • Diffie-Hellman
  • Finite Field Arithmetic
  • Short Hashes
  • Key Derivation
  • SHA
  • License

Generating Random Data

Bindings for the random data generation API. See the libsodium randombytes docs for more information.

Constants

Buffer lengths (integer)

  • randombytes_SEEDBYTES

randombytes_random

sodium-native

var uint32 = sodium.randombytes_random() 

Generates a random 32-bit unsigned integer [0, 0xffffffff] (both inclusive).


randombytes_uniform

sodium-native

var uint = sodium.randombytes_uniform(upper_bound)

Generates a random 32-bit unsigned integer [0, upper_bound) (last exclusive).

  • upper_bound must be at most 0xffffffff

randombytes_buf

sodium-native sodium-javascript

sodium.randombytes_buf(buf)

Fills buf with random data.


randombytes_buf_deterministic

sodium-native

sodium.randombytes_buf_deterministic(buf, seed)

Fills buf with random data, generated from seed.

  • seed must be a buffer of length at least randombytes_SEEDBYTES
← Memory ProtectionHelpers →
  • Constants
  • randombytes_random
  • randombytes_uniform
  • randombytes_buf
  • randombytes_buf_deterministic
Docs
Get StartedAPI
Community
LibsodiumHyperdivisionHyperdivision on Twitter
More
GitHubStar
Copyright © 2020 Hyperdivision