Feature request: UUE operation
- Dominant language
- JavaScript
- Stars
- 35.8k
- Forks
- 4.1k
- Avg merge
- 2d 26m
- Merged PRs (30d)
- 33
Description
I'm love using this software, but don't have needed operation.. I'm talking about uue encoding.
You can find here more information https://en.wikipedia.org/wiki/Uuencoding
I've tried to implement it, but have no luck with it, due to bad js skills.
You can check this implementations:
uuedecode (linux utility from gnu-utils)
https://www.dcode.fr/uu-encoding
Here encoded string "test"
```
begin 644 dcode_uuencode
$=&5S=```
`
end
```
First string is start line, needed, i suppose, for some old mail protocol transmissions. 644 means file permissions, and the dcode_uuencode field is usually file name
After that starts encoding file content itself. First character in line means length of line, and the content after is encoded string
There is might be more than line, due to restriction to 60 bytes per line (it's inherited from old mail protocols)
After this all comes footer, that points end of transmission.
Encoding itself remind base64 encoding. There is also 3 bytes translates to 4, and also ascii only.
I suppose, it's better to create two operations, honestly. First is decoding uue file as is, and second with only encoding algorithm
I've tried using linked site, but it's frustrating. It's always prints error like "invalid format"!
uuedecode utility is better, but require headers to decode
After that I came to solution write my own script using python.
Here is example of code
```
def decode_uu_charset(cipher_text):
import itertools
plain_text = ''
for character_group in itertools.zip_longest(*[iter(cipher_text)]*4, fillvalue="\x00"):
character_group = "".join(character_group)
x = [format(ord(x) - 32, "06b") for x in character_group]
for i in range(len(x)):
if len(x[i]) > 6:
x[i] = "000000"
concated_binary = "".join(x)
for ch in itertools.zip_longest(*[iter(concated_binary)]*8, fillvalue="0"):
ch = chr(int("".join(ch), 2))
plain_text += ch
#print(ch)
#print(character_group, x, concated_binary)
return plain_text
def encode_uu_charset(cipher_text):
import itertools
res = ""
for character_group in itertools.zip_longest(*[iter(cipher_text)]*3, fillvalue="\x00"):
character_group = "".join(character_group)
x = "".join([format(ord(x), "08b") for x in character_group])
for ch in itertools.zip_longest(*[iter(x)]*6,fillvalue='0'):
ch = chr(int("00" + "".join(ch), 2) + 32)
res += ch
#print(ch)
#print(x)
res = res.replace(" ", "`")
return res
```
It's working fine, but don't works so versatile as it can be, if implemented in CyberChef
Sincerely, RegularITCat
Contributor guide
Assessment
This issue has not been assessed yet.