DGRL Posted March 23, 2018 Posted March 23, 2018 Coders Does any of you know if it is possible encrypt txt files? I have some output data written to a txt file using lsp but that is sensitive and i want it to be encrypted and decrypted when the lsp is needing the info again? Quote
DGRL Posted March 23, 2018 Author Posted March 23, 2018 And how to de-compile to read the file again? Or set it as variable and load that back in Quote
DGRL Posted March 23, 2018 Author Posted March 23, 2018 any idea how i can set password protection on xls files using lisp? Quote
ronjonp Posted March 24, 2018 Posted March 24, 2018 And how to de-compile to read the file again?Or set it as variable and load that back in You don't "decompile". You have source code that you compile. Quote
DGRL Posted March 24, 2018 Author Posted March 24, 2018 i wasn't talking about LSP files but txt or other file types lol And fas cant be read by lsp using the read-line funtion as far as i know Quote
BIGAL Posted March 25, 2018 Posted March 25, 2018 You would need a commercial encryptor program that reads / writes. Just Google. You may have to pay for it. Quote
Steven P Posted March 25, 2018 Posted March 25, 2018 How secure do you want the file to be? You could do something very simple that makes it a pain to read, for example at the start of the file list an encryption key, perhaps 7 double digit numbers (65 03 14 etc) then simple go through the text file shifting each character by the next number in the key, either add or subtraction as well. Simple to work out and code I guess. Similarly to hav it password protected you could do similar with the passwird being the key Quote
BIGAL Posted March 26, 2018 Posted March 26, 2018 Have you though about writing a Binary file ? You wont see the text. Its a bit more complicated get & put bytes. Quote
hanhphuc Posted March 26, 2018 Posted March 26, 2018 (edited) Here is basic idea if OP means encrypt/decrypt text file, ie: ascii ;simple XOR cipher - hanhphuc ;reference https://en.wikipedia.org/wiki/XOR_cipher (defun [color="blue"]xor[/color] (str i) (vl-list->string (mapcar ''((x) (boole 6 i x)) (vl-string->list str)))) ;Test= "11110011" = 243 (ascii) _$ (setq str (xor "Hanhphuc" 243 )) [color="red"]; encypt [/color] [color="green"]"»’›ƒ›†"[/color] _$ (xor str 243)[color="red"]; decrypt[/color] [color="green"]"Hanhphuc"[/color] ;Example from wiki "W"; 87 "i"; 105 "k"; 107 "i"; 105 ;example; [color="red"][b]W[/b][/color]iki (ascii (xor "[color="red"]W[/color]" 243) ) ; 164 ;(chr "W") = 87 ;"11110011" = 243 _$ ([color="blue"]menucmd[/color] "M=$([color="blue"]xor[/color], 87, 243)") ; 164 ;Decrypt (xor "‡»¶ó¢¦º°¸ó±¡¼¤½óµ¼«ó¹¦¾£*ó¼¥¶¡ó§»¶ó¿²©ªó·¼´" 211) (xor "ж»þ¯«·½µþ¼¬±©°þ¸±¦þ´«³®*þ±¨»¬þª¶»þ²¿¤§þº±¹" 222) (xor "½ŒÉ˜œ€Š‚É‹›†ž‡É†‘Ƀœ„™šÉ†ŸŒ›ÉŒÉ…ˆ“ɆŽ" 233) "The quick brown fox jumps over the lazy dog" Edited March 26, 2018 by hanhphuc Quote
DGRL Posted March 26, 2018 Author Posted March 26, 2018 Thanks guys/girls for all the idea's cq codes Quote
ronjonp Posted March 26, 2018 Posted March 26, 2018 i wasn't talking about LSP files but txt or other file types lolAnd fas cant be read by lsp using the read-line funtion as far as i know There are a few examples HERE for en\decrypting. Quote
mrroyal102 Posted July 3, 2018 Posted July 3, 2018 hanhphuc can create password strings comparing with encrypt Quote
mrroyal102 Posted July 3, 2018 Posted July 3, 2018 I have an autolisp file: (defun c:test () (vl-registry-read "HKEY_CURRENT_USER\\Software\\Microsoft\\pass") ("HKEY_CURRENT_USER\\Software\\Microsoft\\pass" "" "abcq123") ) (setq Password "HKEY_CURRENT_USER\\Software\\Microsoft\\pass") (setq password (123456789abc) password2 (987654321cba) (setq password password2 ) (setq 1 9) (setq 2 (setq 3 7) (setq 4 6) (setq 5 5) (setq 7 3) (setq 8 2) (setq 9 1) (setq a c) (setq b a) (setq c b) (if (= Password "abc123") (equal password password2 ) fuzz) ) ) please help I want the password to be equal to passwor2 to run lisp Quote
hanhphuc Posted July 3, 2018 Posted July 3, 2018 (edited) not sure i understand, try assoc list [color="green"];vanilla[/color] (defun foo (str) (apply 'strcat (mapcar ''((x) (cond ((cdr ([color="blue"]assoc[/color] (chr x) '([color="purple"]("1" . "9") ("2" . "8") ("3" . "7") ("4" . "6") ("5" . "5") ("6" . "4") ("7" . "3") ("8" . "2") ("9" . "1") ("10" . "0") ("a" . "c") ("b" . "b") ("c" . "a")[/color] ) ) ) ) ("?") ) ) (vl-string->list str) ) ) ) (foo [color="purple"]"123abc"[/color]) [color="green"]"987cba"[/color] ? [color="green"];Vlisp[/color] ([color="blue"]vl-string-translate [/color][color="purple"]"1234567890abc" "9876543210cba"[/color] [color="red"][b]"123abc"[/b][/color]) [color="green"]"987cba"[/color] ? Edited July 3, 2018 by hanhphuc add vlisp version Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.