Skip to content

Instantly share code, notes, and snippets.

@islishude
Created September 2, 2019 03:17
Show Gist options
  • Save islishude/b54325c875f23a46735b329ab61d8546 to your computer and use it in GitHub Desktop.
Save islishude/b54325c875f23a46735b329ab61d8546 to your computer and use it in GitHub Desktop.
address generator tips
func main() {
// ethereum address generator
{
var uncompressed = make([]byte, 65)
hash := sha3.NewLegacyKeccak256()
hash.Write(uncompressed[1:])
address := fmt.Sprintf("%#x", hash.Sum(nil)[12:])
}
// EOS address generator
{
var compressed = make([]byte, 33)
hash := ripemd160.New()
hash.Write([]byte(compressed))
address := fmt.Sprintf("EOS%s", base58.Encode(append(compressed, hash.Sum(nil)[:4]...)))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment