@constantiner/cram-md5-digest
TypeScript icon, indicating that this package has built-in type declarations

0.9.8 • Public • Published

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).

Package Sidebar

Install

npm i @constantiner/cram-md5-digest

Weekly Downloads

9

Version

0.9.8

License

MIT

Unpacked Size

32.9 kB

Total Files

8

Last publish

Collaborators

  • constantiner.me