-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add checksum validation for Ethereum address #630
Add checksum validation for Ethereum address #630
Conversation
h.Write([]byte(strings.ToLower(address))) | ||
hash := hex.EncodeToString(h.Sum(nil)) | ||
|
||
for i := 0; i < len(address); i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here len(address)
definitely has value 40, but I preferred to write len(address)
instead of 40
. Thus we keep the information that "Ethereum addresses have 40 hex digits" declared only in one place, in the regexes.go
(ethAddress{Upper,Lower,}RegexString
).
Let me know if otherwise
@elias19r made one suggested change, other than that looks great and can merge next time I merge a group of PR's |
Explicitly indicate we are ignoring errors from hash.Hash's io.Writer implementation Co-authored-by: Dean Karn <Dean.Karn@gmail.com>
@deankarn Thank you, let me know if you would like me to squash commits or you'll do it upon merging |
@elias19r I'll do it during the merge no worries |
Fixes Or Enhances #631
Make sure that you've checked the boxes below before you submit PR:
Change Details:
@go-playground/admins