3

If the seed on ether.camp is more than 64 chars then I get:

[Error] Error: Invalid hex string
hexWrite (eth-utils.js:17402)
write (eth-utils.js:17477)
fromString (eth-utils.js:17010)
Buffer (eth-utils.js:16980)
toAddress (eth-utils.js:12946)
setPrivateKey (rlpBuilder.js:100)
setSeedPhrase (rlpBuilder.js:95)
setSecretKey (rlpBuilder.js:108)
(anonymous function) (balanceTxDialog.js:76)
dispatch (jquery.min.js:3:8555)
handle (jquery.min.js:3:5258)

I tried to TX with seed with Web Inspector which says:

// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0) 
   throw new Error('Invalid hex string')
if (length > strLen / 2) {
    length = strLen / 2
}
for (var i = 0; i < length; i++) {
    var parsed = parseInt(string.substr(i * 2, 2), 16)
    if (isNaN(parsed)) 
        throw new Error('Invalid hex string')
    buf[offset + i] = parsed
}
return i

The error is permanent in both Safari and Firefox.

Furthermore that limit depends on what chars you put in the Transfer form and can be lower (e.g for !@#$%^^ its only 63).

I tried with another account with much shorter seed <40 chars and everything works fine.

My question is how to produce a hash from my very long seed?

1
  • I merged your posts from the other thread. Thanks for posting a new question, this will allow to answer this more easily. Also I did some formatting. Use two line breaks for new paragraphs, and 4 spaces indent for code formatting.
    – q9f
    Apr 13, 2016 at 19:21

2 Answers 2

2

Since the site dies not appear to accept strings longer than 64 characters, as you said, I would recommend hashing the seed manually using a cryptographic hash, like SHA256. This should return a 64 character hex string that you can then use as the seed.

In Linux, for example, you can use the sha256sum command. There should be similar tools for other OS's as well

3
  • Thanks for suggestion. Simple shasum -a 256 file.txt did not work. There are other options like upper/lower half from sha -a 512, different text encoding etc.I tried some of them but no luck. I get transactions with strange sending addresses.
    – neuron2000
    Apr 14, 2016 at 6:58
  • You really need to be more specific than "did not work" if you want help. What happened? Apr 14, 2016 at 8:55
  • Specifically, the answer did not solve my problem because I already have a seed and its too long to use for transactions. But I appreciated the suggestion to apply different algorithms to produce the hash from my seed. I tried shasum 256,512 ... but the resulting hashes did not point to my account address. Thus 'it did not work' to fit the hash algorithm. There is another aspect of the problem. If the hash for ether.camp created account remains hidden then is becomes difficult to access such account from api.
    – neuron2000
    Apr 14, 2016 at 12:55
1

Here is how to get a useful hash from your seed even if it's too long. You use Keccak-256 hashing algorithm with your seed. The resulting 32byte hash (64 chars [0-9a-f]) is the hash you can use in ether.camp to sign the transactions. Be aware that Keccak-256 is not the same as SHA3. It took some time to figure it out and the info from https://medium.com/@ConsenSys/are-you-really-using-sha-3-or-old-code-c5df31ad2b0#.i1ztcljlm was really helpful. You can use npm to install locally. There are some online tools, but be sure not to rely on your account safety once you paste your seed somewhere in the wilderness. BTW a simple online tool in the ether.camp would be good. Thanks for your valuable input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.