Wednesday, December 27, 2017
Cryptograph Implementation Part 1 One Way Cryptograph
Cryptograph Implementation Part 1 One Way Cryptograph

Methods commonly used hash is MD5, SHA1, RipeMD128. Actually there are many other methods, but the implementation will be presented, the hash method used is the third method. Implementation can be downloaded from this link. By executing the file "exe" of these implementations, we can see that the tool is able to calculate the hash of the plain text or text with the type of file. But, do not try to calculate the hash of the file size> = 10 MB with this tool, unless your processor is quite capable. For indeed, the implementation is designed with no attention to optimization of reading of the file. Please optimizations at will. In this implementation, the main code is in the file "Unit1.pas". File "DCPmd5.pas", "DCPsha1.pas" and "DCPripemd128.pas" is a library of relevant methods provided by DCPCrypt. Meanwhile, the file "DCPcrypt2.pas", "DCPconst.pas", "DCPblockciphers.pas" and "DCPbase64.pas" is a file that is "required" by DCPCrypt to be placed in the same folder as the main code. Or if youve installed the Borland Delphi 7, you can see it all by opening the file "Project1.dpr". Other files can be ignored, because it is the result of "generated" from the compiler.
Okay, lets try surgical "source code" of the tool is to clarify the implementation of one-way cryptographic or "hash" is. Lets look at the main code in line 42 to line 100. There we can see the three functions to calculate the hash of each method. These functions are made by me based on the instructions recommended by DCPCrypt use, which means the function is not "standard", and yes, you can create different versions according to the needs of the implementation you want.
Of the three functions, we can see that the function takes one parameter that has type String, and String will return as well. This I did with a view to maintaining initial format cryptography, from Plain Text Cipher Text-shaped string into string form as well. But again, this is not standard, you can change the type of input parameters into an array of bytes for example, to read the stream.
Then in line 122 to line 171 in the main code, we can see the hash calculation done when user clicks on the "Hash It". We can see, if the user chooses to use the mode "Text", then the code is quite simple, just assign variable "strPlain" with what he was input by the user. Its a bit "tricky" is if the user selects the mode "File", or calculate the hash of the file is selected. Various approaches can be done here. Given three functions for calculating hash Plain Textd need to form a string, then the approach I chose was to change all the "content" file into a string, then assign that string into strPlain. After variable strPlain ready, we put the variable as a parameter in a function to compute a hash with user selected method.
That is just one example of a one-way cryptographic implementations. This implementation can be used to check the aslian a file, because when a file is modified, the hash value will change. If you are interested to see the details of the algorithm of each method, you can see the file "pas" is concerned. Or my advice, try to debug the program, so you can "feel" how the algorithm flow.
alternative link download
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.