Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
185 views
Welcome To Ask or Share your Answers For Others

1 Answer

Repent, 13 7 chars (No file support), 14 char (With file support)

Repent is an esoteric stack-based toy language of my own, with inspiration from J, APL, Golfscript and Python. Here is a short solution. I will explain it, but is very late and this is doing my head in, so I'll explain it and release a Silverlight interpreter in the morning.

↓?|*⊕;€

Explanation:

↓     Copies the message string back onto the stack
?    Puts the extra message string to the bottom of stack
|     Find length of message string
*     Multiply key array by last number - repeats key for at least as long as message
⊕;    Apply XOR between each element corresponding of message array and repeated 
      key array, pushing XOR encoded message to stack
€     Print encoded message string/(char array) as string.

Use like:

Repent "↓?|*⊕;€" "Code Golf" "StackOverflow is Cool" > output.txt

Output (most chars do not display):

Ascii: K    % .L%, 
Hex:   10 1B 05 06 4B 08 19 09 14 25 03 0B 12 00 2E 1C 4C 25 2C 00 08 0D 0A

Using files it is:

↓?▲?▲↓3??|*⊕;▼

Language reference (unfinished)

Interpreter (unfinished)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...