Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayesh09871 committed May 8, 2024
1 parent 772c60c commit b4555e9
Show file tree
Hide file tree
Showing 19 changed files with 8,258 additions and 4,144 deletions.
Empty file added b_Error.txt
Empty file.
Empty file added c_Error.txt
Empty file.
Empty file added e_Error.txt
Empty file.
30 changes: 30 additions & 0 deletions op_codes/opcodes.js
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,
}
Loading

0 comments on commit b4555e9

Please sign in to comment.