talira

gleam_crypto

Cryptography for Gleam on Erlang and JavaScript

open sourceApache-2.0free

gleam_crypto is the Gleam project's cryptography library for both the Erlang and JavaScript targets: hashing (MD5, SHA-1 and the SHA-2 family), HMAC, cryptographically strong random bytes, constant-time comparison, and signing and verifying messages. On JavaScript it uses Node's crypto APIs, available in Node.js, Bun and Deno but not in browsers.

Problems it solves

  • hash data with SHA-256 in Gleam
  • generate secure random bytes in Gleam
  • sign and verify messages in a Gleam app

Features

  • MD5, SHA-1 and SHA-2 hashing
  • HMAC
  • strong random bytes
  • constant-time secure compare
  • message signing and verification
  • Erlang and JavaScript targets

Limitations

  • On JavaScript it needs Node's crypto APIs, so it doesn't work in web browsers.1