Socket
Book a DemoInstallSign in
Socket

expo-crypto

Package Overview
Dependencies
Maintainers
27
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-crypto

Provides cryptography primitives for Android, iOS and web.

14.1.5
latest
Source
npmnpm
Version published
Weekly downloads
598K
6.28%
Maintainers
27
Weekly downloads
 
Created

What is expo-crypto?

The expo-crypto package provides cryptographic utilities for Expo and React Native applications. It allows developers to perform various cryptographic operations such as hashing, HMAC, and generating random bytes.

What are expo-crypto's main functionalities?

Hashing

This feature allows you to generate a hash of a given string using various algorithms like SHA-256. The code sample demonstrates how to generate a SHA-256 hash of the string 'Hello, world!'.

const Crypto = require('expo-crypto');

async function generateHash() {
  const digest = await Crypto.digestStringAsync(
    Crypto.CryptoDigestAlgorithm.SHA256,
    'Hello, world!'
  );
  console.log(digest);
}
generateHash();

HMAC

This feature allows you to generate an HMAC (Hash-based Message Authentication Code) using a specified algorithm and key. The code sample demonstrates how to generate an HMAC using SHA-256 and a secret key.

const Crypto = require('expo-crypto');

async function generateHMAC() {
  const hmac = await Crypto.hmacStringAsync(
    Crypto.CryptoDigestAlgorithm.SHA256,
    'Hello, world!',
    'secret-key'
  );
  console.log(hmac);
}
generateHMAC();

Random Bytes

This feature allows you to generate a specified number of random bytes. The code sample demonstrates how to generate 16 random bytes.

const Crypto = require('expo-crypto');

async function generateRandomBytes() {
  const randomBytes = await Crypto.getRandomBytesAsync(16);
  console.log(randomBytes);
}
generateRandomBytes();

Other packages similar to expo-crypto

Keywords

react-native

FAQs

Package last updated on 06 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.