npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-crypto-algorithm

v1.0.2

Published

Native Module using Kotlin & Swift for React-Native

Downloads

8

Readme

react-native-crypto-algorithm

Installation

npm install react-native-crypto-algorithm

or

yarn add react-native-crypto-algorithm

Installation (iOS)

Using CocoaPods (React Native 0.60 and higher)
cd ios
pod install
Using React Native Link (React Native 0.59 and lower)

Run react-native link react-native-crypto-algorithm after which you should be able to use this library on iOS.

Installation (Android)

React Native 0.60 and higher
  • Linking is done automatically
Using React Native Link (React Native 0.59 and lower)
  • In android/settings.gradle
...
include ':react-native-crypto-algorithm'
project(':react-native-crypto-algorithm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-crypto-algorithm/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-crypto-algorithm')
}
  • register module (in MainApplication.kt)
......
import com.cryptoalgorithm.CryptoAlgorithmPackage;
......

override fun getPackages(): List<ReactPackage> =
  PackageList(this).packages.apply {
    add(CryptoAlgorithmPackage());
  }

Usage

Methods

🚀 AES

  • Custom 'secretKey' -> maximum 32 characters . Custom 'ivKey' (optional) -> maximum 16 characters
  • 🍁 encryptAES(value: string, secretKey: string, ivKey?: string)
  • 🍁 decryptAES(value: string, secretKey: string, ivKey?: string)
import Crypto from 'react-native-crypto-algorithm';

// Encrypt
let encryptData = await Crypto.encryptAES('my message', 'my private key', 'my iv key(optional maximum 16 characters)');

// Decrypt
let decryptData = await Crypto.decryptAES(encryptData, 'my private key', 'my iv key(optional maximum 16 characters)');

🚀 SHA256

  • 🍁 hashSHA256(value: string)
import Crypto from 'react-native-crypto-algorithm';

// Hash SHA256
let hashData = await Crypto.hashSHA256('my hash data');

🚀 RSA

  • 🍁 genRSAKeyPair()
  • 🍁 encryptRSA(value: string, publicKey: string)
  • 🍁 decryptRSA(value: string, privateKey: string)
import Crypto from 'react-native-crypto-algorithm';

// Generate RSA Key Pair
let keyPair = await Crypto.genRSAKeyPair();

// Encrypt RSA
let encryptData = await Crypto.encryptRSA('my message', keyPair.publicKey);

// Decrypt RSA
let decryptData = await Crypto.decryptRSA(encryptData, keyPair.privateKey);

🚀 HMAC / HMAC_AES

  • 🍁 genHmacSecretKey() -> use with all HMAC & HMAC_AES
  • 🍁 encryptHmacAes(value: string, publicKey: string) -> use only for HMAC_AES
  • 🍁 decryptHmacAes(value: string, privateKey: string) -> use only for HMAC_AES
  • 🍁 verifyHmac(value: string, privateKey: string) -> use only for HMAC
import Crypto from 'react-native-crypto-algorithm';

// Generate HMAC & HMAC_AES
let genHmacSecretKey = await Crypto.genHmacSecretKey();

// Encrypt HMAC_AES
let encryptData = await Crypto.encryptHmacAes('my message', genHmacSecretKey);

// Decrypt HMAC_AES
let decryptData = await Crypto.decryptHmacAes(encryptData, genHmacSecretKey);

// VerifyHmac HMAC
let verifyHmacData: boolean = await Crypto.verifyHmac('my message', genHmacSecretKey);

API

List of Algorithms

  • [x] AES(Advanced Encryption Standard)
  • [x] SHA-256 (Secure Hash Algorithm)
  • [x] RSA (Rivest-Shamir-Adleman)
  • [ ] ChaCha20
  • [ ] Blowfish
  • [x] HMAC (Hash-based Message Authentication Code)
  • [ ] PBKDF2 (Password-Based Key Derivation Function 2)
  • [ ] ECC (Elliptic Curve Cryptography)
  • [ ] Scrypt
  • [ ] XChaCha20-Poly1305

Author

Forest Nguyen
Email: [email protected]

License

MIT License
Copyright (c) 2024 Forest Nguyen