Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
788 B

#!/bin/python
import sys
from base64 import b64decode
from hashlib import sha256
from urllib.parse import quote
message = b64decode(sys.argv[1]).decode()
userid = "1"
key = "Rwb3pUUG8fQAZUs3Q3qwdHH25Fdq8dyJyzUQqERzrCfxavKExfSExQbr8dZXho57abGvTZGdBmSbyXdVM59jDVi4L5ien9xoVHskMdx4FxNXyq7uBPYaAeA62JXzMZT9"
domain = "https://hermes.yigitcolakoglu.com/read"
subject = "NIL"
recipient = "NIL"
for i in message.split("\n"):
if i.split(" ")[0] == "Subject:":
subject = i[9:]
elif i.split(" ")[0] == "To:":
recipient = i[4:]
identifier = subject + recipient + userid + key
identifier_hash = sha256(identifier.encode("utf-8")).hexdigest()
url = "{}/{}/{}/{}/{}".format(domain,userid,quote(subject),quote(recipient),identifier_hash)
print('![Hermes]({})'.format(url))