diff options
-rw-r--r-- | app/scripts/lib/personal-message-manager.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index bbc978446..17c9739de 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -118,8 +118,21 @@ module.exports = class PersonalMessageManager extends EventEmitter{ log.debug(`Message was not hex encoded, interpreting as utf8.`) } - return ethUtil.bufferToHex(new Buffer(data, 'utf8')) + return 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 } } + + |