3.0.6 • Published 7 months ago

short-crypt v3.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
7 months ago

ShortCrypt

CI

ShortCrypt is a very simple encryption library, which aims to encrypt any data into something random at first glance. Even if these data are similar, the ciphers are still pretty different. The most important thing is that a cipher is only 4 bits larger than its plaintext so that it is suitable for data used in an URL or a QR Code. Besides these, it is also an ideal candidate for serial number generation.

Usage

import { ShortCrypt } from "short-crypt";

Then, create a ShortCrypt instance with a key (string).

const sc = new ShortCrypt(key);

For encryption, you can choose to use one of these following methods:

  • encrypt: encrypts data to an object, a cipher separated into base and body
  • encryptToURLComponent: encrypts data to a string suitably concatenated with URLs
  • encryptToQRCodeAlphanumeric: encrypts data to a string with the compatibility with QR code alphanumeric mode

Only a string or a byte array can be encrypted.

const cipher1 = sc.encryptToURLComponent(plainText);
const cipher2 = sc.encryptToQRCodeAlphanumeric(plainText);

For decryption, you can use decrypt, decryptURLComponent, or decryptQRCodeAlphanumeric method.

const result1 = sc.decryptURLComponent(cipher1);
const result2 = sc.decryptQRCodeAlphanumeric(cipher2);

Usage for Browsers

Source

Demo Page

License

MIT

3.0.6

7 months ago

3.0.5

8 months ago

2.1.2

1 year ago

2.1.3

1 year ago

3.0.4

1 year ago

3.0.3

1 year ago

3.0.2

1 year ago

3.0.1

1 year ago

3.0.0

1 year ago

2.1.1

1 year ago

2.0.2

1 year ago

1.0.26

2 years ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.22

3 years ago

1.0.11

3 years ago

1.0.21

3 years ago

1.0.10

3 years ago

1.0.20

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.8

4 years ago

1.0.7

5 years ago

1.0.5

5 years ago