hash160
v0.0.5
Published
hash160
Downloads
15
Readme
Hash160 Calculator
This JavaScript module allows you to easily calculate the Hash160 of a given input data. The Hash160 is a common hashing operation used in blockchain technologies, involving two steps: a SHA-256 hash, followed by a RIPEMD-160 hash. This module uses the SHA-256 and RIPEMD-160 functions from the skypack.dev CDN.
Installation
There's no installation required! Since the dependencies are linked through Skypack, you only need to import the module in your JavaScript project to utilize the hash160 function.
Usage
Here's a simple usage example:
import hash160 from 'hash160'
async function example() {
const data = 'Your input data here'
const result = await hash160(data)
console.log(`Hash160 of "${data}" is: ${result}`)
}
example()
Function hash160
takes a string or a Uint8Array as input and returns a promise that resolves to the calculated hash in a hex-encoded string format.
Example of Converting String Data:
const hashResult = await hash160('Example Data')
Example of Converting Uint8Array Data:
const encoder = new TextEncoder()
const data = encoder.encode('Example Data')
const hashResult = await hash160(data)
Demo
Check out the index.html
file in the repository for a simple and interactive web demo illustrating the use of the hash160
function. Simply input the text you'd like to hash, and see the Hash160 calculated in real-time. Try it here.
Try it out:
- Clone the repository
- Open
main.html
in your preferred browser - Input the text you'd like to hash
- The Hash160 result will be displayed below the input field.
Dependencies
- sha256 from Skypack
- ripemd160-min from Skypack
Contributing
We welcome contributions! Please feel free to submit a pull request with any improvements.
License
This project is released under MIT License.