Sujet : Re: base26 Encoder/Decoder
De : pollux (at) *nospam* tilde.club (Stefan Claas)
Groupes : sci.cryptDate : 25. Apr 2024, 17:01:36
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <v0dup1$276id$2@i2pn2.org>
References : 1 2 3
Stefan Claas wrote:
Cri-Cri wrote:
On Fri, 19 Jan 2024 21:05:20 +0100, Stefan Claas wrote:
if you like the Diana Cryptosystem and want to use it with a foreign
language, on an offline Computer, you may find my base26 Encoder/Decoder
useful.
Found a Python version:
https://pypi.org/project/base26/#files
Example:
import base26
base26.encode(b'test')
'EWJILIG'
base26.decode('EWJILIG')
b'test'
I now have a Rust Version, derived from the Python library and
it encodes 'test' with the same result, but when encoding with
Rust, the Python code can not decode properly, while decoding
from Python with Rust works. Oh, well ... :-(
(Wish I was a Programmer!)
Ok, I figured out that my Python3 code example is bad. So the
Rust Version works the same as the library. :-)
$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
import base26
base26.encode(b'The quick brown fox jumps over the lazy dog.')
'AAZCESYRPSBENRDWLUQLYETYZZJCPAHHAVEIPLIONRSBHYUEHANMAUZZQCSOGOXJEBILDQVWRGD'
>
$ echo -n 'AAZCESYRPSBENRDWLUQLYETYZZJCPAHHAVEIPLIONRSBHYUEHANMAUZZQCSOGOXJEBILDQVWRGD' | b26 -d
The quick brown fox jumps over the lazy dog.
$ echo -n 'Hello sci.crypt' | b26
UQZGYLNMDHTUDTGJYKJRQGDKOC
$ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
import base26
base26.decode('UQZGYLNMDHTUDTGJYKJRQGDKOC')
b'Hello sci.crypt'
>
Ok. everything is fine. :-)
-- RegardsStefan