Timo Hocker bf9779dffa update-scanner: automatic update
@scode/encoding-helper: 1.0.27 ==> 1.0.29 minor
@scode/eslint-config: 2.0.13 ==> 2.0.15 minor
2020-05-03 18:16:28 +02:00
2020-03-25 17:02:59 +01:00
2020-03-25 17:02:59 +01:00
2020-03-04 12:18:11 +01:00
2020-03-25 17:02:59 +01:00
2020-03-25 17:02:59 +01:00
2020-03-04 15:01:39 +01:00
2020-05-03 17:00:34 +02:00
2020-03-06 08:40:58 +01:00
2020-03-25 17:02:59 +01:00
2020-03-25 17:02:59 +01:00
2020-05-03 18:16:28 +02:00

Crypto Helper

Helper functions for cryptography

Usage

const crypto = require('@scode/crypto-helper');

const rand_hex = crypto.random_hex(16); // outputs 16 byte random hex
const rand_salt = crypto.create_salt(); // same as random_hex, but with fixed length of 32 bytes
const random_string = crypto.random_string(16) // output 16 character long random string
const hash = crypto.hash_sha512(random_string, random_hex); // returns sha 512 hex
const check = crypto.checksum('foo'); // returns a sha 256 hex

// jwt like object signing
const signed = crypto.sign_object({foo: 'bar'}, 'secret');
const dec = crypto.decode_signed(signed); // decode a signed object without verifying the signature
const ver = crypto.verify_signature(signed, 'secret', 10000); // verifies the signature and returns the contents. the timeout is in milliseconds and optional, timing will be ignored if omitted.
Description
No description provided
Readme 612 KiB
Languages
JavaScript 100%