-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'google-lists' into staging
- Loading branch information
Showing
10 changed files
with
861 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Checks if value is already hashed with sha256 to avoid double hashing | ||
*/ | ||
import * as crypto from 'crypto' | ||
|
||
const sha256HashedRegex = /^[a-f0-9]{64}$/i | ||
|
||
export function sha256SmartHash(value: string): string { | ||
if (sha256HashedRegex.test(value)) { | ||
return value | ||
} | ||
return crypto.createHash('sha256').update(value).digest('hex') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.