3.2.7 • Published 5 months ago

@casual-simulation/crypto v3.2.7

Weekly downloads
42
License
MIT
Repository
github
Last release
5 months ago

Crypto

npm (scoped)

A common set of crypto helpers.

Defines a common interface for crypto implementations between web browsers and Node.js. (Currently only signing/verification and SHA-256 hashing is implemented)

Installation

npm install @casual-simulation/crypto

Usage

// ES6-style imports are required.
// If you are running in an environment that does not support ES Modules,
// then use Webpack or Babel to transpile to the format you want. (like CommonJS)
import { getHash, parsePublicPEMKey } from '@casual-simulation/crypto';

let myHash = getHash('Hello, World');

console.log('Hash: ', myHash);
// Hash: 03675ac53ff9cd1535ccc7dfcdfa2c458c5218371f418dc136f2d19ac1fbe8a5

let publicKeyPEM = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAryQICCl6NZ5gDKrnSztO
3Hy8PEUcuyvg/ikC+VcIo2SFFSf18a3IMYldIugqqqZCs4/4uVW3sbdLs/6PfgdX
7O9D22ZiFWHPYA2k2N744MNiCD1UE+tJyllUhSblK48bn+v1oZHCM0nYQ2NqUkvS
j+hwUU3RiWl7x3D2s9wSdNt7XUtW05a/FXehsPSiJfKvHJJnGOX0BgTvkLnkAOTd
OrUZ/wK69Dzu4IvrN4vs9Nes8vbwPa/ddZEzGR0cQMt0JBkhk9kU/qwqUseP1QRJ
5I1jR4g8aYPL/ke9K35PxZWuDp3U0UPAZ3PjFAh+5T+fc7gzCs9dPzSHloruU+gl
FQIDAQAB
-----END PUBLIC KEY-----`;

let publicKeyBytes = parsePublicPEMKey(publicKeyPEM);
console.log(publicKeyBytes.byteLength);
3.2.7

5 months ago

3.2.0

10 months ago

3.1.23

1 year ago

3.1.11

1 year ago

3.0.14

2 years ago

3.0.0

2 years ago

2.0.22

2 years ago

2.0.14

3 years ago

2.0.12

3 years ago

2.0.0

3 years ago

1.5.11-alpha.42

3 years ago

1.5.11-alpha.41

3 years ago

1.5.11-alpha.40

3 years ago

1.5.11-alpha.39

3 years ago

1.5.7

3 years ago

1.5.0

3 years ago

1.4.7-alpha.33

3 years ago

1.4.7-alpha.32

3 years ago

1.4.4

3 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.0.24

4 years ago

1.0.0

4 years ago

0.11.20

4 years ago

0.11.8

4 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.7

5 years ago

0.9.1

5 years ago

0.8.10

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.5

5 years ago

0.6.0

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago