diff --git a/README.md b/README.md index f4ba57e..f9dbdf5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # What is it? -Hashing Algorithms implemented in ReasonML based on: +Hashing Algorithms implemented in ReScript based on: - [RFC 1321](https://tools.ietf.org/html/rfc1321) - [FIPS180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf) @@ -17,20 +17,20 @@ Hashing Algorithms implemented in ReasonML based on: # How do I install it? ``` -yarn add @space-labs/re-crypt +yarn add rescript-hash ``` or ``` -npm install @space-labs/re-crypt --save +npm install rescript-hash --save ``` -Then add `@space-labs/re-crypt` as a dependency to `bsconfig.json`: +Then add `rescript-hash` as a dependency to `bsconfig.json`: ```diff "bs-dependencies": [ -+ "@space-labs/re-crypt" ++ "rescript-hash" ] ``` @@ -39,41 +39,41 @@ Then add `@space-labs/re-crypt` as a dependency to `bsconfig.json`: ### MD5 ```reason -let hash = ReCrypt.MD5.make("unicorn"); +let hash = ReScriptHash.MD5.make("unicorn"); /* 1abcb33beeb811dca15f0ac3e47b88d9 */ ``` ### SHA-1 ```reason -let hash = ReCrypt.Sha1.make("unicorn"); +let hash = ReScriptHash.Sha1.make("unicorn"); /* 84de6753b298abd027fcd1d790eade2413eafb5a */ ``` ### SHA-224 ```reason -let hash = ReCrypt.Sha224.make("unicorn"); +let hash = ReScriptHash.Sha224.make("unicorn"); /* 983d515094574856a57db3a13741f0a65509bb640bfa551e78fa01d9 */ ``` ### SHA-256 ```reason -let hash = ReCrypt.Sha256.make("unicorn"); +let hash = ReScriptHash.Sha256.make("unicorn"); /* c6cb50e7eea0df1fd3eaf52ada2358f5423afd7c0b5ee2395231a9b3208ffcaf */ ``` ### SHA-384 ```reason -let hash = ReCrypt.Sha384.make("unicorn"); +let hash = ReScriptHash.Sha384.make("unicorn"); /* de41efa2be0844783ea107630a79246fb1f7b3ab97b35c5e4b70130804f876f64b645c1064a775507a7ac3be457539f2 */ ``` ### SHA-512 ```reason -let hash = ReCrypt.Sha512.make("unicorn"); +let hash = ReScriptHash.Sha512.make("unicorn"); /* e233b19aabc7d5e53826fb734d1222f1f0444c3a3fc67ff4af370a66e7cadd2cb24009f1bc86f0bed12ca5fcb226145ad10fc5f650f6ef0959f8aadc5a594b27 */ ``` diff --git a/__tests__/ReCrypt_test.bs.js b/__tests__/ReScriptHash_test.bs.js similarity index 91% rename from __tests__/ReCrypt_test.bs.js rename to __tests__/ReScriptHash_test.bs.js index 23386a7..0b2ee7e 100644 --- a/__tests__/ReCrypt_test.bs.js +++ b/__tests__/ReScriptHash_test.bs.js @@ -3,8 +3,8 @@ var Jest = require("@glennsl/bs-jest/src/jest.bs.js"); var Curry = require("bs-platform/lib/js/curry.js"); -var ReCrypt = require("../src/ReCrypt.bs.js"); var Belt_Array = require("bs-platform/lib/js/belt_Array.js"); +var ReScriptHash = require("../src/ReScriptHash.bs.js"); var tests = [ { @@ -58,7 +58,7 @@ Jest.describe("MD5", (function (param) { return Jest.describe("make()", (function (param) { return Belt_Array.forEach(tests, (function (t) { return Jest.test("\"" + (t.input + "\""), (function (param) { - return Jest.Expect.toBe(t.md5, Jest.Expect.expect(Curry._1(ReCrypt.MD5.make, t.input))); + return Jest.Expect.toBe(t.md5, Jest.Expect.expect(Curry._1(ReScriptHash.MD5.make, t.input))); })); })); })); @@ -68,7 +68,7 @@ Jest.describe("Sha1", (function (param) { return Jest.describe("make()", (function (param) { return Belt_Array.forEach(tests, (function (t) { return Jest.test("\"" + (t.input + "\""), (function (param) { - return Jest.Expect.toBe(t.sha1, Jest.Expect.expect(Curry._1(ReCrypt.Sha1.make, t.input))); + return Jest.Expect.toBe(t.sha1, Jest.Expect.expect(Curry._1(ReScriptHash.Sha1.make, t.input))); })); })); })); @@ -78,7 +78,7 @@ Jest.describe("Sha224", (function (param) { return Jest.describe("make()", (function (param) { return Belt_Array.forEach(tests, (function (t) { return Jest.test("\"" + (t.input + "\""), (function (param) { - return Jest.Expect.toBe(t.sha224, Jest.Expect.expect(Curry._1(ReCrypt.Sha224.make, t.input))); + return Jest.Expect.toBe(t.sha224, Jest.Expect.expect(Curry._1(ReScriptHash.Sha224.make, t.input))); })); })); })); @@ -88,7 +88,7 @@ Jest.describe("Sha256", (function (param) { return Jest.describe("make()", (function (param) { return Belt_Array.forEach(tests, (function (t) { return Jest.test("\"" + (t.input + "\""), (function (param) { - return Jest.Expect.toBe(t.sha256, Jest.Expect.expect(Curry._1(ReCrypt.Sha256.make, t.input))); + return Jest.Expect.toBe(t.sha256, Jest.Expect.expect(Curry._1(ReScriptHash.Sha256.make, t.input))); })); })); })); @@ -98,7 +98,7 @@ Jest.describe("Sha384", (function (param) { return Jest.describe("make()", (function (param) { return Belt_Array.forEach(tests, (function (t) { return Jest.test("\"" + (t.input + "\""), (function (param) { - return Jest.Expect.toBe(t.sha384, Jest.Expect.expect(Curry._1(ReCrypt.Sha384.make, t.input))); + return Jest.Expect.toBe(t.sha384, Jest.Expect.expect(Curry._1(ReScriptHash.Sha384.make, t.input))); })); })); })); @@ -108,7 +108,7 @@ Jest.describe("Sha512", (function (param) { return Jest.describe("make()", (function (param) { return Belt_Array.forEach(tests, (function (t) { return Jest.test("\"" + (t.input + "\""), (function (param) { - return Jest.Expect.toBe(t.sha512, Jest.Expect.expect(Curry._1(ReCrypt.Sha512.make, t.input))); + return Jest.Expect.toBe(t.sha512, Jest.Expect.expect(Curry._1(ReScriptHash.Sha512.make, t.input))); })); })); })); diff --git a/__tests__/ReCrypt_test.res b/__tests__/ReScriptHash_test.res similarity index 85% rename from __tests__/ReCrypt_test.res rename to __tests__/ReScriptHash_test.res index c544e90..02027ad 100644 --- a/__tests__/ReCrypt_test.res +++ b/__tests__/ReScriptHash_test.res @@ -62,7 +62,7 @@ let tests = [ describe("MD5", () => describe("make()", () => tests->Belt.Array.forEach(t => - test("\"" ++ (t.input ++ "\""), () => expect(ReCrypt.MD5.make(t.input)) |> toBe(t.md5)) + test("\"" ++ (t.input ++ "\""), () => expect(ReScriptHash.MD5.make(t.input)) |> toBe(t.md5)) ) ) ) @@ -70,7 +70,7 @@ describe("MD5", () => describe("Sha1", () => describe("make()", () => tests->Belt.Array.forEach(t => - test("\"" ++ (t.input ++ "\""), () => expect(ReCrypt.Sha1.make(t.input)) |> toBe(t.sha1)) + test("\"" ++ (t.input ++ "\""), () => expect(ReScriptHash.Sha1.make(t.input)) |> toBe(t.sha1)) ) ) ) @@ -78,7 +78,7 @@ describe("Sha1", () => describe("Sha224", () => describe("make()", () => tests->Belt.Array.forEach(t => - test("\"" ++ (t.input ++ "\""), () => expect(ReCrypt.Sha224.make(t.input)) |> toBe(t.sha224)) + test("\"" ++ (t.input ++ "\""), () => expect(ReScriptHash.Sha224.make(t.input)) |> toBe(t.sha224)) ) ) ) @@ -86,7 +86,7 @@ describe("Sha224", () => describe("Sha256", () => describe("make()", () => tests->Belt.Array.forEach(t => - test("\"" ++ (t.input ++ "\""), () => expect(ReCrypt.Sha256.make(t.input)) |> toBe(t.sha256)) + test("\"" ++ (t.input ++ "\""), () => expect(ReScriptHash.Sha256.make(t.input)) |> toBe(t.sha256)) ) ) ) @@ -94,7 +94,7 @@ describe("Sha256", () => describe("Sha384", () => describe("make()", () => tests->Belt.Array.forEach(t => - test("\"" ++ (t.input ++ "\""), () => expect(ReCrypt.Sha384.make(t.input)) |> toBe(t.sha384)) + test("\"" ++ (t.input ++ "\""), () => expect(ReScriptHash.Sha384.make(t.input)) |> toBe(t.sha384)) ) ) ) @@ -102,7 +102,7 @@ describe("Sha384", () => describe("Sha512", () => describe("make()", () => tests->Belt.Array.forEach(t => - test("\"" ++ (t.input ++ "\""), () => expect(ReCrypt.Sha512.make(t.input)) |> toBe(t.sha512)) + test("\"" ++ (t.input ++ "\""), () => expect(ReScriptHash.Sha512.make(t.input)) |> toBe(t.sha512)) ) ) ) diff --git a/bsconfig.json b/bsconfig.json index 3af5475..3b1eb01 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -1,5 +1,5 @@ { - "name": "@space-labs/re-crypt", + "name": "rescript-hash", "version": "1.4.0", "sources": [ { diff --git a/package.json b/package.json index d0effa4..0ddfc05 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@space-labs/re-crypt", + "name": "rescript-hash", "description": "Secure Hash Algorithms for ReScript", "version": "1.4.0", "scripts": { @@ -10,16 +10,17 @@ "test": "bsb -clean-world && bsb -make-world && jest", "test:watch": "bsb -clean-world && bsb -make-world && jest --watchAll" }, - "homepage": "https://github.com/eWert-Online/re-crypt#readme", - "bugs": "https://github.com/eWert-Online/re-crypt/issues", + "homepage": "https://github.com/eWert-Online/rescript-hash#readme", + "bugs": "https://github.com/eWert-Online/rescript-hash/issues", "repository": { "type": "git", - "url": "git+https://github.com/eWert-Online/re-crypt.git" + "url": "git+https://github.com/eWert-Online/rescript-hash.git" }, "keywords": [ "reason", "bucklescript", "rescript", + "hash", "crypto", "cryptography", "md5", diff --git a/src/ReCrypt.bs.js b/src/ReCrypt.bs.js deleted file mode 100644 index bff2a46..0000000 --- a/src/ReCrypt.bs.js +++ /dev/null @@ -1,29 +0,0 @@ -// Generated by ReScript, PLEASE EDIT WITH CARE -'use strict'; - -var ReCrypt_MD5 = require("./ReCrypt/ReCrypt_MD5.bs.js"); -var ReCrypt_Sha1 = require("./ReCrypt/ReCrypt_Sha1.bs.js"); -var ReCrypt_Sha224 = require("./ReCrypt/ReCrypt_Sha224.bs.js"); -var ReCrypt_Sha256 = require("./ReCrypt/ReCrypt_Sha256.bs.js"); -var ReCrypt_Sha384 = require("./ReCrypt/ReCrypt_Sha384.bs.js"); -var ReCrypt_Sha512 = require("./ReCrypt/ReCrypt_Sha512.bs.js"); - -var MD5 = ReCrypt_MD5; - -var Sha1 = ReCrypt_Sha1; - -var Sha224 = ReCrypt_Sha224; - -var Sha256 = ReCrypt_Sha256; - -var Sha384 = ReCrypt_Sha384; - -var Sha512 = ReCrypt_Sha512; - -exports.MD5 = MD5; -exports.Sha1 = Sha1; -exports.Sha224 = Sha224; -exports.Sha256 = Sha256; -exports.Sha384 = Sha384; -exports.Sha512 = Sha512; -/* No side effect */ diff --git a/src/ReCrypt.res b/src/ReCrypt.res deleted file mode 100644 index 426b775..0000000 --- a/src/ReCrypt.res +++ /dev/null @@ -1,23 +0,0 @@ -module MD5 = { - include ReCrypt_MD5 -} - -module Sha1 = { - include ReCrypt_Sha1 -} - -module Sha224 = { - include ReCrypt_Sha224 -} - -module Sha256 = { - include ReCrypt_Sha256 -} - -module Sha384 = { - include ReCrypt_Sha384 -} - -module Sha512 = { - include ReCrypt_Sha512 -} diff --git a/src/ReScriptHash.bs.js b/src/ReScriptHash.bs.js new file mode 100644 index 0000000..e5a5d87 --- /dev/null +++ b/src/ReScriptHash.bs.js @@ -0,0 +1,29 @@ +// Generated by ReScript, PLEASE EDIT WITH CARE +'use strict'; + +var ReScriptHash_MD5 = require("./ReScriptHash/ReScriptHash_MD5.bs.js"); +var ReScriptHash_Sha1 = require("./ReScriptHash/ReScriptHash_Sha1.bs.js"); +var ReScriptHash_Sha224 = require("./ReScriptHash/ReScriptHash_Sha224.bs.js"); +var ReScriptHash_Sha256 = require("./ReScriptHash/ReScriptHash_Sha256.bs.js"); +var ReScriptHash_Sha384 = require("./ReScriptHash/ReScriptHash_Sha384.bs.js"); +var ReScriptHash_Sha512 = require("./ReScriptHash/ReScriptHash_Sha512.bs.js"); + +var MD5 = ReScriptHash_MD5; + +var Sha1 = ReScriptHash_Sha1; + +var Sha224 = ReScriptHash_Sha224; + +var Sha256 = ReScriptHash_Sha256; + +var Sha384 = ReScriptHash_Sha384; + +var Sha512 = ReScriptHash_Sha512; + +exports.MD5 = MD5; +exports.Sha1 = Sha1; +exports.Sha224 = Sha224; +exports.Sha256 = Sha256; +exports.Sha384 = Sha384; +exports.Sha512 = Sha512; +/* No side effect */ diff --git a/src/ReScriptHash.res b/src/ReScriptHash.res new file mode 100644 index 0000000..5ee39e1 --- /dev/null +++ b/src/ReScriptHash.res @@ -0,0 +1,23 @@ +module MD5 = { + include ReScriptHash_MD5 +} + +module Sha1 = { + include ReScriptHash_Sha1 +} + +module Sha224 = { + include ReScriptHash_Sha224 +} + +module Sha256 = { + include ReScriptHash_Sha256 +} + +module Sha384 = { + include ReScriptHash_Sha384 +} + +module Sha512 = { + include ReScriptHash_Sha512 +} diff --git a/src/ReCrypt.resi b/src/ReScriptHash.resi similarity index 100% rename from src/ReCrypt.resi rename to src/ReScriptHash.resi diff --git a/src/ReCrypt/ReCrypt_MD5.bs.js b/src/ReScriptHash/ReScriptHash_MD5.bs.js similarity index 100% rename from src/ReCrypt/ReCrypt_MD5.bs.js rename to src/ReScriptHash/ReScriptHash_MD5.bs.js diff --git a/src/ReCrypt/ReCrypt_MD5.res b/src/ReScriptHash/ReScriptHash_MD5.res similarity index 100% rename from src/ReCrypt/ReCrypt_MD5.res rename to src/ReScriptHash/ReScriptHash_MD5.res diff --git a/src/ReCrypt/ReCrypt_MD5.resi b/src/ReScriptHash/ReScriptHash_MD5.resi similarity index 100% rename from src/ReCrypt/ReCrypt_MD5.resi rename to src/ReScriptHash/ReScriptHash_MD5.resi diff --git a/src/ReCrypt/ReCrypt_Sha1.bs.js b/src/ReScriptHash/ReScriptHash_Sha1.bs.js similarity index 100% rename from src/ReCrypt/ReCrypt_Sha1.bs.js rename to src/ReScriptHash/ReScriptHash_Sha1.bs.js diff --git a/src/ReCrypt/ReCrypt_Sha1.res b/src/ReScriptHash/ReScriptHash_Sha1.res similarity index 100% rename from src/ReCrypt/ReCrypt_Sha1.res rename to src/ReScriptHash/ReScriptHash_Sha1.res diff --git a/src/ReCrypt/ReCrypt_Sha1.resi b/src/ReScriptHash/ReScriptHash_Sha1.resi similarity index 100% rename from src/ReCrypt/ReCrypt_Sha1.resi rename to src/ReScriptHash/ReScriptHash_Sha1.resi diff --git a/src/ReCrypt/ReCrypt_Sha224.bs.js b/src/ReScriptHash/ReScriptHash_Sha224.bs.js similarity index 100% rename from src/ReCrypt/ReCrypt_Sha224.bs.js rename to src/ReScriptHash/ReScriptHash_Sha224.bs.js diff --git a/src/ReCrypt/ReCrypt_Sha224.res b/src/ReScriptHash/ReScriptHash_Sha224.res similarity index 100% rename from src/ReCrypt/ReCrypt_Sha224.res rename to src/ReScriptHash/ReScriptHash_Sha224.res diff --git a/src/ReCrypt/ReCrypt_Sha224.resi b/src/ReScriptHash/ReScriptHash_Sha224.resi similarity index 100% rename from src/ReCrypt/ReCrypt_Sha224.resi rename to src/ReScriptHash/ReScriptHash_Sha224.resi diff --git a/src/ReCrypt/ReCrypt_Sha256.bs.js b/src/ReScriptHash/ReScriptHash_Sha256.bs.js similarity index 100% rename from src/ReCrypt/ReCrypt_Sha256.bs.js rename to src/ReScriptHash/ReScriptHash_Sha256.bs.js diff --git a/src/ReCrypt/ReCrypt_Sha256.res b/src/ReScriptHash/ReScriptHash_Sha256.res similarity index 100% rename from src/ReCrypt/ReCrypt_Sha256.res rename to src/ReScriptHash/ReScriptHash_Sha256.res diff --git a/src/ReCrypt/ReCrypt_Sha256.resi b/src/ReScriptHash/ReScriptHash_Sha256.resi similarity index 100% rename from src/ReCrypt/ReCrypt_Sha256.resi rename to src/ReScriptHash/ReScriptHash_Sha256.resi diff --git a/src/ReCrypt/ReCrypt_Sha384.bs.js b/src/ReScriptHash/ReScriptHash_Sha384.bs.js similarity index 100% rename from src/ReCrypt/ReCrypt_Sha384.bs.js rename to src/ReScriptHash/ReScriptHash_Sha384.bs.js diff --git a/src/ReCrypt/ReCrypt_Sha384.res b/src/ReScriptHash/ReScriptHash_Sha384.res similarity index 100% rename from src/ReCrypt/ReCrypt_Sha384.res rename to src/ReScriptHash/ReScriptHash_Sha384.res diff --git a/src/ReCrypt/ReCrypt_Sha384.resi b/src/ReScriptHash/ReScriptHash_Sha384.resi similarity index 100% rename from src/ReCrypt/ReCrypt_Sha384.resi rename to src/ReScriptHash/ReScriptHash_Sha384.resi diff --git a/src/ReCrypt/ReCrypt_Sha512.bs.js b/src/ReScriptHash/ReScriptHash_Sha512.bs.js similarity index 100% rename from src/ReCrypt/ReCrypt_Sha512.bs.js rename to src/ReScriptHash/ReScriptHash_Sha512.bs.js diff --git a/src/ReCrypt/ReCrypt_Sha512.res b/src/ReScriptHash/ReScriptHash_Sha512.res similarity index 100% rename from src/ReCrypt/ReCrypt_Sha512.res rename to src/ReScriptHash/ReScriptHash_Sha512.res diff --git a/src/ReCrypt/ReCrypt_Sha512.resi b/src/ReScriptHash/ReScriptHash_Sha512.resi similarity index 100% rename from src/ReCrypt/ReCrypt_Sha512.resi rename to src/ReScriptHash/ReScriptHash_Sha512.resi