You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Personal sign decoding and hashing inconsistency #60
Every personal-sign message in MM starts with the user approving a readable text. Whether it's words, numbers or emojis, it's all just text, which is supposed to make sense somehow to the user approving it. It is therefore expected all these messages would be treated the same when hashed to the personal message format.
Unfortunately, this is not the case. What happens is that number formated messages and mixed characters messages are decoded from utf8 encoding. However, hex formated messages are have an exception, they are decoded with hex encoding.
The hex decoding seems to be coincidental. Otherwise, why wouldn't more text format, e.g. numbers, not be decoded in a special way also?
Why this happens
MetaMask uses this logic to sign personal sign messages:
In any case, changing the behaviour now will be too big of a breaking change for apps that rely on this.
At this point, we should just accept that hex-appearing texts are dealt differently than any other text format, including numbers.
Activity
dougdyson commentedon Oct 23, 2022
Hello! Is there a workaround for passing a hash as a message to personal_sign without the hash being rehashed by MM? Thanks!