Skip to content
Verified contractExactMIT

Puzzle

Address0x7fb04216bb1e00cc3283dfd363a9d4de292ef2af
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.38

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.38+commit.1835d247
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,399,566
Creation transaction
0x1ce58b0102…ad3423dd0e

Puzzle.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @title Puzzle
contract Puzzle {
    mapping(address => bytes) private byAuthor;

    constructor(bytes memory c) {
        byAuthor[msg.sender] = c;
    }

    function solve(uint256 who) external view returns (string memory) {
        address author = address(uint160(who));
        bytes memory c = byAuthor[author];
        bytes32 k = keccak256(abi.encodePacked(author));
        bytes memory out = new bytes(c.length);
        bytes32 s;

        for (uint256 i = 0; i < c.length; ++i) {
            if (i % 32 == 0) {
                s = keccak256(abi.encodePacked(k, i / 32));
            }
            out[i] = c[i] ^ s[i % 32];
        }
        return string(out);
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.