Consider the following Ethereum account I created at MyEtherWallet:

{ version: 3,
  id: '4447b704-e28c-4e93-8b1d-32f519b46692',
  address: '115312fc0ab77a0fb15a66baf51f58baefcee1dd',
   { ciphertext: '299dd3b289bbfa049b42b9e8caff2a37ea9cc0606b33dad64afbb9b8aa5b2bc7',
     cipherparams: { iv: 'ab6abe38032296123b16b029cfce8240' },
     cipher: 'aes-128-ctr',
     kdf: 'scrypt',
      { dklen: 32,
        salt: '2605c6988ea0c68dd8c363e29f815bbabb329a74493abc6766cad31b85b6fa2a',
        n: 1024,
        r: 8,
        p: 1 },
     mac: 'f4425caa02c682c74ffe1ba546ddec1f7e85b573848b896ef1e80f09adbc5511' } }

The n value of kdfparams is 1024. Other implementations seem to have the number of hashing rounds set to 262144 (mentioned over at keythereum). Are these parameters less secure? If so, to what extent? If not, why not?


Well, let's start:

First, AES is not a HASHING function, but a cryptography function. It's not the same, so do not mix both.

The number of rounds means, obviously, more security. It's a encryption basic. The higher number of transformations made, the less vulnerable to decryption attacks and analysis. But more rounds means also more execution time and resources, so you must find a mid-point in which you optimize security and computation resources. For me, it seems 1024 a fair number.

In your case, the weakest point is the IV. The IV shall never be a fixed value, but a random or pseudorandom one, due to using fixed IV makes your encryption weaker and more vulnerable to "cryptoanalysis" attacks.

Hope my answer will help you.

  • FWIW, The reason MyEtherWallet uses a smaller number than, say, geth, is that this not reasonable to use such a high number in browser. For example, decrypting a keystore from Mist takes 20-30 seconds via Javascript. In Firefox, this is especially frustrating as it times out twice and you must hit continue and hope for the best. – tayvano Oct 4 '16 at 9:57
  • Could you please expand on why you consider 1024 to be fair? The default number of rounds Geth uses is 256 times larger than MEW. From my layman perspective, that seems pretty significant. – StuffAndThings Oct 4 '16 at 22:39
  • @thoCoStuff Well, as you say geth uses 256 times larger number of rounds (262144) while for example keythereum uses just 65536. As i've studied a little bit of cryptography, 1024 is fair enough for a fair security-optimization. As i've said in my answers, its obviously more secure the more number of rounds, but In my opinion (i mean i just an opinion, the mine) 1024 shall cover the security measures pretty fairly. I guess you have lowered the number of rounds for faster computation, or something else. So 1024 would be a nice number. – KanekiDev Oct 5 '16 at 9:07
  • In this discussion, "number of rounds" is being considered in isolation. The difference in value could be due to different KDF (key derivation function). Different KDFs may work with different values. In fact, different KDFs may even have different parameters. For example, in my Parity installation, KDF is "pbkdf2", the number of rounds parameter is "c" and is 10240. There is also a PRF parameter, set to "hmac-sha256". In OP's case, KDF is "scrypt", number of rounds param is "n", and there is no PRF parameter, maybe because the script has the logic for random generation so a PRF is not needed. – Ajoy Bhatia Apr 25 '17 at 0:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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