(defun SnvalidEncryptWrapping ( str EncryptFoo )
(if (snvalid str)
(EncryptFoo str)
(prompt "\nString not valid to be encrypted.")
)
)
Same with the decriptive function.How strong does it need to be?Very soft...
(defun _RotateTextByMap ( text textmap / n codes )
;; Caller's job to ensure textmap is of even length!!
(setq
n (/ (strlen textmap) 2)
codes (vl-string->list textmap)
codes (append codes codes)
)
(vl-list->string
(mapcar
(function
(lambda ( x / lst )
(if (setq lst (member x codes))
(nth n lst)
x
)
)
)
(vl-string->list text)
)
)
)
(defun _Rot13 ( text )
;; See: http://en.wikipedia.org/wiki/ROT13
;;
;; Basically does a safe text rotation. If rotated twice
;; returns the original string. Very simple obfuscation
;; to thwart casual browsing by uninitiated eyes.
;;
;; NOTE: FORCES UPPERCASE
;;
;; (_Rot13 "abc ABC xyz XYZ 012 789") >> "ONP ONP KLM KLM 012 789"
;; (_Rot13 "567 fgh STU 234 VWX cde") >> "ABC ABC XYZ XYZ 012 789"
(_RotateTextByMap
(strcase text)
"ABCDEFGHIJKLMONPQRSTUVWXYZ"
)
)
(defun _Rot31 ( text )
;; (_Rot31 "abc ABC xyz XYZ 012 789") >> "567 fgh STU 234 VWX cde"
;; (_Rot31 "567 fgh STU 234 VWX cde") >> "abc ABC xyz XYZ 012 789"
(_RotateTextByMap
text
(strcat
"0123456789"
"ABCDEFGHIJKLMONPQRSTUVWXYZ"
"abcdefghijklmonpqrstuvwxyz"
)
)
)
(defun _Rot40 ( text )
;; (_Rot40 "abc ABC xyz XYZ 012 789") >> "123 klm NOP $%& _ab ghi"
;; (_Rot40 "123 klm NOP $%& _ab ghi") >> "abc ABC xyz XYZ 012 789"
(_RotateTextByMap
text
(strcat
"!#$%&()-0123456789@ABCDEFGHIJKLMNOPQRSTU"
"VWXYZ[]^_abcdefghijklmnopqrstuvwxyz{}~©¶"
)
)
)
(defun testsnvalid (str / Countr Caract)
(setq Countr 1)
(repeat (strlen str)
(if (snvalid (setq Caract (substr str Countr 1)))
(princ Caract)
(progn (print Caract) (princ " < NOT valid - Valid > "))
)
(setq Countr (1+ Countr))
)
(princ)
)
(testsnvalid "!#$%&()-0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{}~©¶")
"!" < NOT valid - Valid > #$%&()-0123456789
"@" < NOT valid - Valid > ABCDEFGHIJKLMNOPQRSTUVWXYZ
"[" < NOT valid - Valid >
"]" < NOT valid - Valid > ^_abcdefghijklmnopqrstuvwxyz
"{" < NOT valid - Valid >
"}" < NOT valid - Valid > ~©¶
May I use this version also for Bricscad?(defun _Rot40 ( text )
(_RotateTextByMap
text
(strcat
;"!#$%&()-0123456789@ABCDEFGHIJKLMNOPQRSTU"
"#$%&()-0123456789ABCDEFGHIJKLMNOPQRSTU"
;"VWXYZ[]^_abcdefghijklmnopqrstuvwxyz{}~©¶"
"VWXYZ^_abcdefghijklmnopqrstuvwxyz~©¶"
)
)
)
Technically it would be Rot37. I don't have Brics so can't help (notwithstanding, no play time avail).Ok grazie. :)
(defun _Obfus ( text mask )
;; (setq
;; text "MyCollectionName"
;; mask1 ""
;; mask2 "wat"
;; mask3 "HHGTTG"
;; )
;;
;; (_Obfus text mask1) >> "EyDjolljtjjiHiec"
;; (_Obfus "EyDjolljtjjiHiec" mask1) >> "MyCollectionName"
;;
;; (_Obfus text mask2) >> "MFCoS90c&iPnN^m7"
;; (_Obfus "MFCoS90c&iPnN^m7" mask2) >> "MyCollectionName"
;;
;; (_Obfus text mask3) >> "k_fo^IeQFLIHhGHW"
;; (_Obfus "k_fo^IeQFLIHhGHW" mask3) >> "MyCollectionName"
( (lambda ( a b ok n )
(while (< (length b) n) (setq b (append b (reverse b))))
(vl-list->string
(mapcar
(function
(lambda ( a b / x )
(if (and (member a ok) (member (setq x (boole 6 a b)) ok))
x
a
)
)
)
a
b
)
)
)
(vl-string->list text)
(cond ((mapcar (function (lambda (x) (- x 34))) (vl-string->list mask))) ('(8 6 7 5 3 0 9)))
(vl-string->list "#$%&()-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_abcdefghijklmnopqrstuvwxyz~©¶")
(strlen text)
)
)
Wrote a quick & dirty func over lunch ...Grande, I think this is quite enough. :) :) :)
Cheers.
Hi,thanks to gile, it's too technical thread for me... :?
This remember me this other thread (https://www.theswamp.org/index.php?topic=16722.0).