https://github.com/tsirysndr/react-native-cryptr
react-native-cryptr is a simple encrypt and decrypt module for react native
https://github.com/tsirysndr/react-native-cryptr
crypto react-native
Last synced: about 2 months ago
JSON representation
react-native-cryptr is a simple encrypt and decrypt module for react native
- Host: GitHub
- URL: https://github.com/tsirysndr/react-native-cryptr
- Owner: tsirysndr
- Created: 2017-10-06T21:04:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-09T21:46:49.000Z (over 8 years ago)
- Last Synced: 2025-03-14T11:04:11.976Z (over 1 year ago)
- Topics: crypto, react-native
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-cryptr
react-native-cryptr is a simple encrypt and decrypt module for react native
It is for doing simple encryption of values UTF-8 strings that need to be decrypted at a later time.
If you require anything more than that you probably want to use something more advanced or [react-native-crypto](https://www.npmjs.com/package/react-native-crypto) directly.
The Cryptr constructor takes 1 required and 1 optional argument.
Cryptr(secret[, algorithm])
If an algorithm is not provided it defaults to `aes-256-ctr`.
**DO NOT USE THIS MODULE FOR ENCRYPTING PASSWORDS!**
Passwords should be a one way hash. Use [react-native-bcrypt](https://www.npmjs.com/package/react-native-bcrypt) for that.
## Install
npm install react-native-cryptr
## Usage
``` javascript
var Cryptr = require('react-native-cryptr'),
cryptr = new Cryptr('myTotalySecretKey');
var encryptedString = cryptr.encrypt('bacon'),
decryptedString = cryptr.decrypt(encryptedString);
console.log(encryptedString); // d7233809c0
console.log(decryptedString); // bacon
```