Skip to content

Instantly share code, notes, and snippets.

@karmacoma-eth
Created December 19, 2022 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karmacoma-eth/8da1c74a284206e633312db882816777 to your computer and use it in GitHub Desktop.
Save karmacoma-eth/8da1c74a284206e633312db882816777 to your computer and use it in GitHub Desktop.
A little EVM program that decodes and returns XOR-encoded data (fits in a tweet)
// compiles to the following bin-runtime: 7f2a447b3991925d0aa0728f5e78315948d6cb14530bc6ae127f114971abe35db87f452f5b4ef4b2336fc516af2a17113e27f69f612162a8c9321c7e2401c78629dd18600052596000f3
// (run with e.g. `evm --code <bin-runtime> run | cast --to-ascii`)
#define macro MAIN() = takes(0) returns(0) {
0x2a447b3991925d0aa0728f5e78315948d6cb14530bc6ae127f114971abe35db8 // ciphertext
0x452f5b4ef4b2336fc516af2a17113e27f69f612162a8c9321c7e2401c78629dd // key (which happens to be the keccak hash of the message)
xor
0x00 mstore
// returns 0x6F6B207765206E65656420746F20676F20547572696E6720636F6D706C657465
msize 0x00 return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment