#! /usr/bin/env python3
#
# This (powerful) code is public domain.

import sys
from hashlib import sha256 as H

# obviously the KEK should be retrieved from somewhere else
KEK = b"super secret default KEK"

while True:
    try: # parse GET 0xdeadbeef
        req = sys.stdin.readline())
        assert req[0:6] == "GET 0x" and req[-1] == "\n"
        hdata = bytes.fromhex(req[6:-1])
        print(f"DEK 0x{H(hdata + KEK).hexdigest()}")
    except Exception as e:
        print(f"ERR {e}")
