From 1954b878191e08db04188f0934b15ebe8c2c5a84 Mon Sep 17 00:00:00 2001 From: caktux Date: Tue, 30 Dec 2014 11:59:33 -0500 Subject: [PATCH] bring back toHex --- lib/main.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/main.js b/lib/main.js index 59c60cfa8..b6601132d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -227,6 +227,16 @@ var web3 = { _events: {}, providers: {}, + toHex: function(str) { + var hex = ""; + for(var i = 0; i < str.length; i++) { + var n = str.charCodeAt(i).toString(16); + hex += n.length < 2 ? '0' + n : n; + } + + return hex; + }, + toAscii: function(hex) { // Find termination var str = "";