Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Encryption/Decryption

 [1/3] from: ptretter:charter at: 5-Jul-2001 14:31


I have a problem with a script I'm working on and can't figure out why it doesn't work right. The problem is that it wont decrypt the file after encrypting it. See script below. Any suggestions? BTW: this is a crude script at the moment. ------------------------- REBOL [ author: "Paul Tretter" product: "Encryption/Decryption program" comment {This program encrypts data and decrypts data for file security} ] crypt-key: to-binary "REBOL" crypt-port: make port! [ scheme: 'crypt algorithm: 'blowfish direction: 'encrypt strength: 128 key: crypt-key padding: true ] data-sec: layout [banner "Paul's Encrypt/Decrypt Util" toggle "Encrypt" "Decrypt" [either value [crypt- port/direction: 'decrypt][crypt-port/direction: 'encrypt]] button "Choose file" [inputfile: request-file] button "process" [ open crypt-port insert crypt-port read/binary to-file inputfile update crypt-port write/binary %outputfile copy crypt-port close crypt-port ] ] view data-sec

 [2/3] from: holger:rebol at: 5-Jul-2001 17:31


On Thu, Jul 05, 2001 at 02:31:58PM -0400, [ptretter--charter--net] wrote:
> I have a problem with a script I'm working on and can't figure out > why it doesn't work right. The problem is that it wont decrypt the > file after encrypting it. See script below. Any suggestions? BTW: > this is a crude script at the moment.
You are trying to change the 'direction field in your port after creating it. This is not possible. All fields have to be set to their proper values at the time the port is created. You could try something like this (not tested though): crypt-port-spec: [ scheme: 'crypt algorithm: 'blowfish direction: 'encrypt strength: 128 key: crypt-key padding: true ] ... toggle "Encrypt" "Decrypt" [ change next find crypt-port-spec to-set-word 'direction pick [decrypt encrypt] value ] ... crypt-port: make port! crypt-port-spec -- Holger Kruse [holger--rebol--com]

 [3/3] from: ptretter::charter::net at: 5-Jul-2001 19:32


Excellent thanks Holger. I started to believe I wasnt going to find an answer. Paul Tretter