-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
772c60c
commit b4555e9
Showing
19 changed files
with
8,258 additions
and
4,144 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
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,30 @@ | ||
const crypto = require('crypto'); | ||
|
||
|
||
// OP_HASH function | ||
function OP_HASH(s) { | ||
let hash = crypto.createHash('sha256').update(s, 'hex').digest(); | ||
hash = crypto.createHash('ripemd160').update(hash).digest(); | ||
// console.log(Buffer.from(hash).toString("hex")); | ||
return Buffer.from(hash).toString("hex") | ||
} | ||
|
||
// HASH256 function | ||
function HASH256(input){ | ||
const h1 = crypto.createHash('sha256').update(Buffer.from(input, 'hex')).digest() | ||
return crypto.createHash('sha256').update(h1).digest('hex') | ||
} | ||
|
||
|
||
|
||
// SHA-256 function | ||
function SHA256(input) { | ||
return crypto.createHash('sha256').update(input).digest(); | ||
} | ||
|
||
|
||
module.exports = { | ||
OP_HASH, | ||
HASH256, | ||
SHA256, | ||
} |
Oops, something went wrong.