Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

convert-hex

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert-hex

Convert to/from hex string and array of bytes

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

convert-hex

JavaScript component to convert to/from hex strings and byte arrays.

AMD/CommonJS compatible.

Install

Node.js/Browserify

npm install --save cryptocoin-convert-hex

Component

component install cryptocoin/convert-hex

Bower

bower install cryptocoin/convert-hex

Script

<script src="/path/to/convert-hex.js"></script>

Usage

(if using script, the global is convertHex)

bytesToHex(bytes)

var convertHex = require('convert-hex')

var bytes = [0x34, 0x55, 0x1, 0xDF]
console.log(convertHex.bytesToHex(bytes)) //"345501df"

hexToBytes(hexStr)

var hex = "34550122DF" //"0x" prefix is optional
console.dir(conv.hexToBytes(hex).join(',')) //'[52,85,1,34,223]'

Credits

Loosely inspired by code from here: https://github.com/vbuterin/bitcoinjs-lib & CryptoJS

License

(MIT License)

Copyright 2013, JP Richardson jprichardson@gmail.com

Keywords

FAQs

Package last updated on 21 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc