Skip to content

Instantly share code, notes, and snippets.

@signorecello
Last active September 6, 2023 06:45
Show Gist options
  • Save signorecello/dad41f8b90ae48c7355bfd1f34f8885b to your computer and use it in GitHub Desktop.
Save signorecello/dad41f8b90ae48c7355bfd1f34f8885b to your computer and use it in GitHub Desktop.
Convert public key to ethereum address in Noir
let hashOfPubKey = std::hash::keccak256(pub_key);
let mut result : Field = 0;
let mut v : Field = 1;
for i in 0..20 {
let index = (20 - i);
result += hashOfPubKey[index + 11] as Field * v;
v *= 256;
}
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment