aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-03-07 09:19:36 +0800
committerDan Finlay <dan@danfinlay.com>2017-03-07 09:20:57 +0800
commitcdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455 (patch)
tree0da69b786966b79578ce817dfeaa66ee170309d5
parent2acf991b67bc42fb904ff77af6ff6a7ca3a683fd (diff)
downloadtangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.tar
tangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.tar.gz
tangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.tar.bz2
tangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.tar.lz
tangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.tar.xz
tangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.tar.zst
tangerine-wallet-browser-cdcd1b1e8b9219ad2f5b6f029e3f0bc48e879455.zip
Fix hex encoding of message to create valid hex strings
-rw-r--r--app/scripts/lib/personal-message-manager.js15
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
}
}
+
+