0.9.8 • Published 4 years ago

@constantiner/cram-md5-digest v0.9.8

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

cram-md5-digest-js

Build Status codecov

CRAM-MD5 digester implementation in JavaScript with zero dependencies.

It uses a digest string from server and generates a hash using a secret (usually, password).

The library supports converting the resulting hash to Base64-encoded string.

Installation

npm install @constantiner/cram-md5-digest

Changelog

Versions changelog.

Usage

import { cramMd5DigestBase64 } from "@constantiner/cram-md5-digest";

cramMd5DigestBase64("voxjx70j131lv9g645j6Znx8535l5Xb1nkl6CF0489lE2Gc^b*H&F5jn", "1$G15/iw");

Documentation

cramMd5Digest

import { cramMd5Digest } from "@constantiner/cram-md5-digest";

Generates MD5 hash from passwordString and cramKey.

It has the following parameters:

  • passwordString Is a secret (password) to hash (String).
  • cramKey Is a key (digest) to hash password with (String).

It returns a 32 symbols length string with calculated hash.

cramMd5DigestBase64

import { cramMd5DigestBase64 } from "@constantiner/cram-md5-digest";

Generates MD5 hash from passwordString and cramKey and encodes it in Base64.

It has the following parameters:

  • passwordString Is a secret (password) to hash (String).
  • cramKey Is a key (digest) to hash password with (String).
  • padding (optional, default value is false) if true there is Base64 padding (=) added.

It returns a string with Base64-encoded hash (with padding or not).