sha512-crypt-ts
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -20,24 +20,2 @@ "use strict"; | ||
/* | ||
* These are the functions you'll usually want to call | ||
* They take string arguments and return either hex or base-64 encoded strings | ||
*/ | ||
Delegate.prototype.hex_sha512 = function (s) { | ||
return this.rstr2hex(this.rstr_sha512(this.str2rstr_utf8(s))); | ||
}; | ||
Delegate.prototype.b64_sha512 = function (s) { | ||
return this.rstr2b64(this.rstr_sha512(this.str2rstr_utf8(s))); | ||
}; | ||
Delegate.prototype.any_sha512 = function (s, e) { | ||
return this.rstr2any(this.rstr_sha512(this.str2rstr_utf8(s)), e); | ||
}; | ||
Delegate.prototype.hex_hmac_sha512 = function (k, d) { | ||
return this.rstr2hex(this.rstr_hmac_sha512(this.str2rstr_utf8(k), this.str2rstr_utf8(d))); | ||
}; | ||
Delegate.prototype.b64_hmac_sha512 = function (k, d) { | ||
return this.rstr2b64(this.rstr_hmac_sha512(this.str2rstr_utf8(k), this.str2rstr_utf8(d))); | ||
}; | ||
Delegate.prototype.any_hmac_sha512 = function (k, d, e) { | ||
return this.rstr2any(this.rstr_hmac_sha512(this.str2rstr_utf8(k), this.str2rstr_utf8(d)), e); | ||
}; | ||
/* | ||
* Calculate the SHA-512 of a raw string | ||
@@ -177,17 +155,2 @@ */ | ||
/* | ||
* Encode a string as utf-16 | ||
*/ | ||
Delegate.prototype.str2rstr_utf16le = function (input) { | ||
var output = ""; | ||
for (var i = 0; i < input.length; i++) | ||
output += String.fromCharCode(input.charCodeAt(i) & 0xFF, (input.charCodeAt(i) >>> 8) & 0xFF); | ||
return output; | ||
}; | ||
Delegate.prototype.str2rstr_utf16be = function (input) { | ||
var output = ""; | ||
for (var i = 0; i < input.length; i++) | ||
output += String.fromCharCode((input.charCodeAt(i) >>> 8) & 0xFF, input.charCodeAt(i) & 0xFF); | ||
return output; | ||
}; | ||
/* | ||
* Convert a raw string to an array of big-endian words | ||
@@ -474,4 +437,4 @@ * Characters >255 have their high-byte silently ignored. | ||
var char_2 = void 0; | ||
char_1 = input.charCodeAt(order[i + 0]) & parseInt("00111111", 2); | ||
char_2 = (input.charCodeAt(order[i + 0]) & parseInt("11000000", 2)) >>> 6; | ||
char_1 = input.charCodeAt(order[i]) & parseInt("00111111", 2); | ||
char_2 = (input.charCodeAt(order[i]) & parseInt("11000000", 2)) >>> 6; | ||
output += tab.charAt(char_1) + tab.charAt(char_2); | ||
@@ -484,4 +447,4 @@ } | ||
var char_4 = void 0; | ||
char_1 = input.charCodeAt(order[i + 0]) & parseInt("00111111", 2); | ||
char_2 = (((input.charCodeAt(order[i + 0]) & parseInt("11000000", 2)) >>> 6) | | ||
char_1 = input.charCodeAt(order[i]) & parseInt("00111111", 2); | ||
char_2 = (((input.charCodeAt(order[i]) & parseInt("11000000", 2)) >>> 6) | | ||
(input.charCodeAt(order[i + 1]) & parseInt("00001111", 2)) << 2); | ||
@@ -488,0 +451,0 @@ char_3 = (((input.charCodeAt(order[i + 1]) & parseInt("11110000", 2)) >> 4) | |
{ | ||
"name": "sha512-crypt-ts", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Typescript wrapper for SHA-512, including $6$ crypt format.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -8,14 +8,15 @@ [![codecov](https://codecov.io/gh/bedlaj/sha512-crypt-ts/branch/master/graph/badge.svg)](https://codecov.io/gh/bedlaj/sha512-crypt-ts) | ||
# Installation | ||
Install [NPM package](https://www.npmjs.com/package/sha512-crypt-ts) | ||
#### Install [NPM package](https://www.npmjs.com/package/sha512-crypt-ts) | ||
``` | ||
npm install --save sha512-crypt-ts | ||
``` | ||
Import module | ||
####Import module | ||
``` | ||
import { sha512 } from 'sha512-crypt-ts'; | ||
``` | ||
Usage | ||
####Usage | ||
``` | ||
sha512.sha512crypt('password', 'saltsalt'); // Returns $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0ktL3nh/ | ||
sha512.sha512crypt('password', 'saltsalt'); | ||
// Returns $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0ktL3nh/ | ||
``` | ||
Another examples can be found in [unit tests](https://github.com/bedlaj/sha512-crypt-ts/blob/master/tests/sha512.test.ts) or in peer project [bedlaj/unifi-reset-password](https://github.com/bedlaj/unifi-reset-password/blob/master/src/app/app.component.ts). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22
25560
491