diff options
-rw-r--r-- | app/scripts/lib/personal-message-manager.js | 15 | ||||
-rw-r--r-- | test/unit/personal-message-manager-test.js | 2 |
2 files changed, 2 insertions, 15 deletions
diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index ddc3ee39c..bbc978446 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -118,21 +118,8 @@ module.exports = class PersonalMessageManager extends EventEmitter{ log.debug(`Message was not hex encoded, interpreting as utf8.`) } - return this.hexEncode(data) - } - - hexEncode(text){ - var hex, i - - var result = '' - for (i = 0; i < text.length; i++) { - hex = text.charCodeAt(i).toString(16) - result += ('000' + hex).slice(-4) - } - return '0x' + result + return ethUtil.bufferToHex(new Buffer(data, 'utf8')) } } - - diff --git a/test/unit/personal-message-manager-test.js b/test/unit/personal-message-manager-test.js index 41ac3db87..f2c01392c 100644 --- a/test/unit/personal-message-manager-test.js +++ b/test/unit/personal-message-manager-test.js @@ -91,7 +91,7 @@ describe('Personal Message Manager', function() { it('converts text to a utf8 hex string', function() { var input = 'hello' var output = messageManager.normalizeMsgData(input) - assert.equal(output, '0x00680065006c006c006f', 'predictably hex encoded') + assert.equal(output, '0x68656c6c6f', 'predictably hex encoded') }) it('tolerates a hex prefix', function() { |