Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need Encryption Algorythm in AutoLisp

263 views
Skip to first unread message

Rick Stanich

unread,
Aug 21, 1998, 3:00:00 AM8/21/98
to
Send me the code and I will see what is possible


Robert Albert wrote:

> Hello:
>
> I need a function which takes a string as an argument and returns another
> string with the following characteristics:
>
> 1. All the returned strings must be the same number of characters. Eight
> characters would be good. Here are some examples: 487rrh47 skk2311k
> 129a09gr
>
> 2. Any combination of characters and/or numbers. It's okay if there are
> never numbers or never letters. Case is unimportant.
>
> 3. The algorithm must be based on a key which we will hard code into our
> program, and which will be encrypted with Vital Lisp and invisible to the
> user.
>
> Some well-meaning people have emailed me with helpful advise which might as
> well have been written in Klingon. Since I cannot understand C++, C or
> Common Lisp, or heavy programming concepts such as "fast exponentiation" or
> "inverse-modulus code" and a dozen other "really simple" things people have
> referred me to, none of the email has been useful. I will make the code
> available to everyone once I am finished with it. If anyone out there
> knows how to interpret these encryption algorithm schemes which I've been
> refered to, (I'll be glad to pass them on) and can help me to translate
> them into AutoLisp, I'd surely appreciate it!!
>
> --
>
> Robert Albert
> Director of Technical Services
> Microsol Resources Corporation
> ral...@microsolresources.com


vcard.vcf

Brian Debelius

unread,
Aug 21, 1998, 3:00:00 AM8/21/98
to
take a look at this, http://www.ultimateprivacy.com/te.hisotp.html

an excerpt, they claim their implementation is unbreakable.

The key for the first OTP implementation, the Vernam Cipher, was a random
series of letters that were added to the plain message text to produce the
unbreakable cipher text. Thus, each letter of the alphabet was assigned a
numerical value, such as A=1, B=2…Z=26. When key letter "L" (12) was added
to plain text letter "D" (4), the resulting cipher text letter was "P" (16).
For values greater than 26, the alphabet was repeated so that 27=A,
28=B...52=Z. To decrypt an OTP message, the key was merely subtracted from
the cipher text.

brian-


bert Albert wrote in message <01bc800b$7eeeb520$526384a9@tech-services>...

Owen Wengerd

unread,
Aug 21, 1998, 3:00:00 AM8/21/98
to
Brian & Robert:

I took a look at the ultimateprivacy.com site. Although they discuss the
OTP (one-time-pad) in great detail, that's really not what they're selling.
They're selling hardware devices which generate random numbers. I doubt
that this is what Robert wanted.

There are several good encryption links on our links page at
http://www.cadlock.com/links.htm worth taking a look at. You should have a
look at the Snake Oil FAQ

http://www.cis.ohio-state.edu/hypertext/faq/usenet/cryptography-faq/snake-oi
l/faq.html ) before using *any* encryption software. I don't know of any
lisp implementations of the common encryption algorithms, but I'm sure
someone has done this in the past. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com


Brian Debelius wrote in message <6rkn5c$5b...@adesknews2.autodesk.com>...


>take a look at this, http://www.ultimateprivacy.com/te.hisotp.html
>
>an excerpt, they claim their implementation is unbreakable.

>[...]

rur...@sbox.tu-graz.ac.at

unread,
Aug 23, 1998, 3:00:00 AM8/23/98
to
1) The vernom cipher -invented by julius caesar- is the easiest breakable
encryption of all!
you get the goal simply by applying some statistics on occurances in the
encrypted string.

the trick is using a VERY long cypher which is not transported together with
the encrypted string.

2) roberts goal is mathematically underdefined, and principally unsolvable.


>1. All the returned strings must be the same number of characters.

how to splice a char of 255 states into a char of 36 states?
this could be possible with some heavy compression techniques (huffmann or lzw
for example) but if it works for every string is not guaranteed and cannot be
generally guaranteed.

3) if we assume that the string to be encrypted is of the same order as
the resulting string (36 valid chars) it is very easy and unbreakable by
generating a long sequence of random characters and encryptr your string
with the random cypher-string as generator. xor is enough. and use a simple
alphabet to map the result onto the valid charset.
|;

(std-require 'stdmath) ; for random only

;; generate the cypher, this should be quite long and not
;; transported together with with the code!
(defun init-cypher (len / s i)
(setq *cypher* nil)
(setq *encypher-pos* 0)
(setq *decypher-pos* 0)
(setq *cypher-len* len)
(repeat len
(setq *cypher* (cons (std-random 36) *cypher*)))
)

;;; map the decrypted char [0-9],[A-Z] to int 65-101,
;;; force uppercase,
;;; result is guaranteed to be in [65-101]
(defun enmap-char (c / i)
(setq i (ascii c))
(if (<= 97 i 122) (setq i (- i 32))) ; force upcase
(if (<= 48 i 57) (setq i (+ i 43))) ; 0-9 above Z
(+ 65 (rem (abs (- i 65)) 36)) ; force interval 65-101
)

;;; map the encrypted int 65-101 to [0-9],[A-Z]
;;; result is a one-char string in [0-9][A-Z]
(defun demap-char (i)
(chr (cond ((<= 65 i 90) i)
((> i 90) (- i 43)))
))

(defun encrypt-string (s / i l crypt)
(setq l (strlen s) i 1 crypt "")
(while (<= i l)
(setq crypt (strcat crypt (demap-char
(encypher-fun (enmap-char (substr s i 1))
(nth *encypher-pos* *cypher*))))
i (1+ i)
*encypher-pos* (rem (1+ *encypher-pos*) *cypher-len*))
)
crypt
)

(defun decrypt-string (s / i l crypt)
(setq l (strlen s) i 1 crypt "")
(while (<= i l)
(setq crypt (strcat crypt (demap-char
(decypher-fun (enmap-char (substr s i 1))
(nth *decypher-pos* *cypher*))))
i (1+ i)
*decypher-pos* (rem (1+ *decypher-pos*) *cypher-len*))
)
crypt
)

;; use simple shifting by the cypher:
; x: 65-101, y: 0-35 => 65-101
; (ENCYPHER-FUN 78 33) => 75
(defun encypher-fun (x y)
(+ 65 (rem (+ (- x 65) y) 36)))

; x: 65-101, y: 0-35 => 65-101
; (DECYPHER-FUN 75 33) => 78 ??
(defun decypher-fun (x y)
(while (< (- x y) 65)
(setq x (+ x 36)))
(- x y))

(defun test ()
(init-cypher 1000)
(setq s1 "einkleinenachtmusik123")
(setq s2 "undnocheine987")
(print s1)(princ " => ")
(princ (setq es1 (encrypt-string s1)))
(print s2)(princ " => ")
(princ (setq es2 (encrypt-string s2)))
(print (decrypt-string es1))
(print (decrypt-string es2))
(prin1)
)

"einkleinenachtmusik123" => N95PPUZGQUOBK9BQ1JTQOI
"undnocheine987" => 1VZTEZHNXPNZC6
"EINKLEINENACHTMUSIK123"
"UNDNOCHEINE987"


In article <6rkn5c$5b...@adesknews2.autodesk.com>,


"Brian Debelius" <bdeb...@naitech.com> wrote:
> take a look at this, http://www.ultimateprivacy.com/te.hisotp.html
>
> an excerpt, they claim their implementation is unbreakable.
>

> The key for the first OTP implementation, the Vernam Cipher, was a random
> series of letters that were added to the plain message text to produce the
> unbreakable cipher text. Thus, each letter of the alphabet was assigned a
> numerical value, such as A=1, B=2…Z=26. When key letter "L" (12) was added
> to plain text letter "D" (4), the resulting cipher text letter was "P" (16).
> For values greater than 26, the alphabet was repeated so that 27=A,
> 28=B...52=Z. To decrypt an OTP message, the key was merely subtracted from
> the cipher text.
>
> brian-


>
> Robert Albert wrote in message <01bc800b$7eeeb520$526384a9@tech-services>...

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

0 new messages