Jump to content

IDEA File Encryption


RazerM
 Share

Recommended Posts

I have posted File Encryption UDF's before, but they used file dialogs, input boxes and a fixed output file.

Now both functions are called using

#include <File.au3>
_FileEncrypt($FileInput, $FileOutput, $sKey)
_FileDecrypt($FileInput, $FileOutput, $sKey)

Very simple!

IDEA encryption is used, I downloaded encrypt.com from http://www.cypherspace.org/adam/rsa/idea.html

FileEncryption.au3

Previous Downloads: 533

Comments welcome...

Update 01: updated _WriteEncryptCom - more "compact" (Thanks erifash)

Update 02: Fixed to work on 3.2.4.6

Update 03: Found small bug in __FileCopy, fixed

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Nice! I think I have seen that "encrypt.com" file somewhere on the internet, it could just be a generic name though. One thing that could use improvement is the way you store the file inside the script. Here is a much better version of your _WriteEncryptCom() function:

Func _WriteEncryptCom()
Local $c="0x"
$c&="E81A01BAE402BE8000AC0AC0740AACAC3C2D74073C2B7407E9FE00FE06DD01AD"
$c&="AC3C2077FB884CFFB2F0B409CD21B2F6B40ACD21B110BEF8025156B104BE8203"
$c&="BF9A03F3A55E56E8DC00BE9A03568BFEE8E600B104BE7A03BF8A0357F3A55F5E"
$c&="56E802018BF7BF7A03E8C3005F5E5657E8B300B104BE8A03F3A55E8BFEE8B900"
$c&="B104BE8203BF92035657F3A55F57BE9A03E8D2005E5FE896005E83C60859E299"
$c&="BF7A03E89300BA8400B8023DCD21720B93B90080BA0A04B43FCD2172590BC074"
$c&="5C5250538BFA050700B103D3E891BE7A035157BF0204E88D00B904005EF8720F"
$c&="AD86E03305AB86E08944FEE2F3EB0F8B1DAD86E0AB33D886FB895CFEE2F18BFE"
$c&="59E2CB5B5A52F7DA49B80142CD21595AB440CD21739BBADE02B409CD21BFF702"
$c&="B91381F3AAC3B104AD86E0ABE2FAC3B90400AD3305ABE2FAC383C710B3088BC3"
$c&="24073C068B45F28B55F472088B55E474038B45E2B109D3E0B107D3EA0BC2AB43"
$c&="80FB3475D9C3C606780308578B158B4D028B6D048B7D06E8500093AD03C8AD03"
$c&="E88BD7E8440097515533EB33CF8BD5E8380003C8958BD1E8300003E89133D933"
$c&="FD5A5833CA33E88BD3FE0E780375C8E8180093AD03E8AD03C88BD7E80C005F57"
$c&="93AB95AB91AB93AB5FC352ADF7E22BC25A7507402B44FE2BC2C3150000C34572"
$c&="726F72094944454120F12046696C65244B65793A202480"
FileDelete(@TempDir & "\encrypt.com")
Return FileWrite(@TempDir & "\encrypt.com", BinaryString($c))
EndFunc

I have compared the file exported by your function and the one by mine and they are exactly the same. Hope that helps! :)

Link to comment
Share on other sites

I never really though of doing that, but I will implement it. Thanks.

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

  • 2 months later...

I don't get how the _WriteEncryptCom() encrypts, can you explain it please?

It does not encrypt, it writes a small programm (encrypt.com) to the TEMP dir and then uses that file to do whatever encrypt.com does...

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

  • 1 month later...

Thanks for the compliment.

Also, 228 downloads and less than 5 have commented :)

Edited by RazerM
My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

ya I definately know that feeling 64 downloads and 2 comments on X-Hide :)

I added the encryption to X-Hide, made a new GUI, and renamed it Securacy(Security+Privacy), but I ran into a bit of a problem....this cant encrypt folders can it??? (if so its a coding problem so sorry for wastin time)...Is there any way to encrypt a directory?

Edited by Psibernetic

[sup]Psibernetic[/sup]My Creations:X-HideSecuracy

Link to comment
Share on other sites

That's a joke right? its IDEA not IKEA :)

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

I improved on your Encrypt function, it was what kept me back so long (no offense)... I believe the runwait command was having some difficulties laying out the commands correctly, so i made minor chnages that fixed the problem for me... hope it helps :]

;===============================================================================
;
; Function Name:    _PsiEncrypt()
; Description:      Secondary Method incase _FileEncrypt() fails to encrypt
; Parameter(s):     $FileInput - File to encrypt
;                   $FileOutput - Where to save encrypted file
;                   $szKey - Key to encrypt file with
; Requirement(s):   File.au3
; Author(s):        RazorM, Psibernetic
;
;===============================================================================
Func _PsiEncrypt($FileInput, $FileOutput, $szKey)
    FileCopy($FileInput, $FileOutput, 9)
    If Not FileExists(@TempDir & "\encrypt.com") Then
        _WriteEncryptCom()
    EndIf
    $xFileNAme=@ComSpec & " /c echo " & $szKey & "|" & "encrypt.com" & " + " & FileGetShortName($FileOutput)
    RunWait($xFileNAme, @TempDir, @SW_HIDE)
    FileDelete(@TempDir & "\encrypt.com")
EndFunc

[sup]Psibernetic[/sup]My Creations:X-HideSecuracy

Link to comment
Share on other sites

THen I should have replied!

I think this is great. I use it on my teaching gradebook program. When you open the program you choose a .db file, and it will ask for a password, and decrypt based on that keystring; then try to open the file. if the fiel is invalid, then the decryption had the wrong key, and you get kicked out of the program. Now my students' grades are safe and I can have multiple database files. (these are sqllite files)

I think such a setup will be useful for any thousand of applications. a database backed app is so much more useful, and to keep it encrypted so the user cant mess it up, and a virus cant even get in there without the passcode.

This is great, and i couldnt have done it if it wasnt so easy to use in a UDF, thanks!

Link to comment
Share on other sites

@Psibernetic

I don't see any reason why my _FileEncrypt UDF won't work because of the runwait params. Also, Filecopy doesn't rename files.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

@Psibernetic

I don't see any reason why my _FileEncrypt UDF won't work because of the runwait params. Also, Filecopy doesn't rename files.

Yes, i didnt see an issue either, but regardless it simply failed encrypting...so it was my belief that it was in your UDF's and I narrowed it down to the runwait command, using the workdir instead of filegetshortbname(@tempDir & "\encrypt.com"), I beleive is what fixed it...

btw im not meining to rewrite your UDF, just figured I would share my results with you and everyone elese incase same problem arises

[sup]Psibernetic[/sup]My Creations:X-HideSecuracy

Link to comment
Share on other sites

  • 6 months later...

Thanks for the compliment.

ALso, 228 downloads and less than 5 have commented :whistle:

I know the feeling ... although on the bright side I got help when I was really stuck.

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

Found a bug in __FileCopy but it's fixed now. Probably fixed your problem Psibernetic.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

It runs very fast on XP, strange.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...