Loading ...
Sorry, an error occurred while loading the content.

Encrypt Selection - completed?

Expand Messages
  • jonas_ramus
    Hi all, The NoteTab Utilities Clip Library contains an Encrypt Selection and Decrypt Selection Clip. The problem with this is that Decrypt Selection
    Message 1 of 1 , May 27, 2005
    • 0 Attachment
      Hi all,

      The NoteTab "Utilities" Clip Library contains an "Encrypt Selection"
      and "Decrypt Selection" Clip.

      The problem with this is that "Decrypt Selection" could change the
      encrypted text unintentionally or intentionally when using a wrong
      password, i.e. a password that hasn't been used for encrypting that
      text.

      I tried to combine both Clips and build in a kind of password check.
      It works like this...

      First, you have to choose your personal password - let's say "Otto".
      This password has to be checked with a small Clip...

      ^!Set %Key%=^?{Enter password:}
      ^!Set %Proof%=^$GetCrcText(^%Key%)$
      ^!Info ^%Proof%

      Next, you have to note the CRC-number that has been output by that
      Clip, or you may copy it to the clipboard. The CRC-value of "Otto"
      is 3630852159.

      Now edit the following Encryption Clip, go to the third line and
      enter that CRC-value as the value to be assigned to %Proof%. From
      now on, that Clip could only be run when entering your personal
      password. I understand that nobody could get the password from that
      CRC-value or use the CRC-value for decrypting the text - isn't it?

      :Start
      ^!ClearVariables
      ^!Set %Proof%=3630852159
      ^!If ^$GetSelSize$=0 Error_3
      ^!SetWizardLabel Encryption or Decryption of Selected Text
      ^!Set %Exe%=^?{I want to have the selected
      text...=_encrypted|decrypted}
      ^!IfSame "^%Exe%" "encrypted" Encrypt Else Decrypt
      ^!IfError Start

      :Encrypt
      ^!Set %Key%=^?{Enter password:}
      ^!If ^$GetCrcText(^%Key%)$=^%Proof% Next Else Error_2
      ^!Set %Text%=^$GetSelection$
      ^!Set %NewText%=^$StrEncrypt("^%Text%";"^%Key%")$
      ^!Set %CrcText%=^$GetCrcText("^%Text%")$
      ^!Set %CrcNewText%=^$GetCrcText("^$StrDecrypt("^%NewText%";"^%Key%")
      $")$
      ^!If ^%CrcText%<>^%CrcNewText% Error_1
      ^!InsertCode ^%NewText%
      ^!Goto End

      :Decrypt
      ^!Set %Key%=^?{Enter password:}
      ^!If ^$GetCrcText(^%Key%)$=^%Proof% Next Else Error_2
      ^!InsertCode ^$StrDecrypt("^$GetSelection$";"^%Key%")$
      ^!Goto End

      :Error_1
      ^!Prompt An error occurred during the encryption process.
      ^!GoTo End

      :Error_2
      ^!Prompt Wrong password!
      ^!GoTo End

      :Error_3
      ^!Prompt Please select the text to encrypt before using this command
      ^!Goto End

      :Error
      ^!Prompt

      Anything wrong with that solution?

      Regards
      Jonas
    Your message has been successfully submitted and would be delivered to recipients shortly.