Skip to content

Commit

Permalink
chore: use std/hash/sha256.ts instead of x/sha256/mod.ts (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
uki00a committed Jul 30, 2020
1 parent e594136 commit 6c8dc95
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
9 changes: 1 addition & 8 deletions dem.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"/fs/ensure_dir.ts",
"/fs/exists.ts",
"/fs/expand_glob.ts",
"/hash/sha256.ts",
"/node/process.ts",
"/path/mod.ts"
]
Expand Down Expand Up @@ -40,14 +41,6 @@
"/mod.ts"
]
},
{
"protocol": "https",
"path": "deno.land/x/sha256",
"version": "v1.0.2",
"files": [
"/mod.ts"
]
},
{
"protocol": "https",
"path": "deno.land/x/sqlite",
Expand Down
6 changes: 4 additions & 2 deletions src/util/StringUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sha256 } from "../../vendor/https/deno.land/x/sha256/mod.ts";
import { Sha256 } from "../../vendor/https/deno.land/std/hash/sha256.ts";

/**
* Converts string into camelCase.
Expand Down Expand Up @@ -102,7 +102,9 @@ interface IHashOptions {
* @param options.length Optionally, shorten the output to desired length.
*/
export function hash(input: string, options: IHashOptions = {}): string {
const hashedInput = sha256(input, "utf8", "hex") as string;
const sha256 = new Sha256();
sha256.update(input);
const hashedInput = sha256.hex();

if (options.length) {
return hashedInput.slice(0, options.length);
Expand Down
1 change: 1 addition & 0 deletions vendor/https/deno.land/std/hash/sha256.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "https://deno.land/std@v0.62.0/hash/sha256.ts";
1 change: 0 additions & 1 deletion vendor/https/deno.land/x/sha256/mod.ts

This file was deleted.

0 comments on commit 6c8dc95

Please sign in to comment.