Code Monkey home page Code Monkey logo

Comments (10)

BrianGladman avatar BrianGladman commented on July 18, 2024

Unfortunately the files you have provided contain a number of errors. When these errors are corrected they then produce a good result (see the attached screenshot). I have attached a zip file that contains all the files that I used to produce a good result.
p2k
fcrypt.zip

from aes.

tajiknomi avatar tajiknomi commented on July 18, 2024

Strange ! I have compiled your fcrypt.zip on my linux machine and the results are different.

screenshot from 2018-07-30 14-35-04

Same is the result when "pwd2key.c" is consider as the main source.

2

from aes.

BrianGladman avatar BrianGladman commented on July 18, 2024

Unfortunately I don't use Linux or GCC so I cannot help you directly. To see where the code is going wrong we need to check the values held in the two arrays uu and ux within the loop starting at line 83 in pwd2key.c. I have attached a zip archive that includes a modified version of pwd2key.c (which outputs these arrays in this loop) and output.txt that gives the result when I run it. If you use this version of pwd2key.c, it should allow us to see where the results are different for you. If you let me have your results I may be able to see what is going wrong for you.

looptest.zip

from aes.

tajiknomi avatar tajiknomi commented on July 18, 2024

Result is here

results.txt

The left one is my machine generated results and the right one is yours. The values changes at uu_0[0]. I have highlighted the region from where the values are changed.

3

from aes.

BrianGladman avatar BrianGladman commented on July 18, 2024

In fact the changes you have noticed do not matter because only the first four values are used. But you are right that the error occurs in the first execution in the loop and seems to occur in SHA1. I have a more recent implementation that you might like to try - I have attached the files in a zip archive.
fcrypt_new.zip

Please let me know if this also gives the errors.

from aes.

tajiknomi avatar tajiknomi commented on July 18, 2024

Just tested your latest files. The keys are good now.

4

Which file do you actually changed to get the correct result ? The problem was in SHA1 ?

from aes.

BrianGladman avatar BrianGladman commented on July 18, 2024

The issue was somewhere in the SHA1 code. The code you were using is very old so I just replaced it with my current SHA1 and SHA2 code.

from aes.

tajiknomi avatar tajiknomi commented on July 18, 2024

fileenc.c and fileenc.h are the old implementation in the fcrypt_new.zip which you had attached recently. You have changed hmac_sha1_begin(cx->auth_ctx) to hmac_sha_begin(2 arguments). It will be helpful if you could provide me the latest fileenc.c and fileenc.h

from aes.

BrianGladman avatar BrianGladman commented on July 18, 2024

My fileenc application is very old and I no longer maintain it so there is no later version. But it depends on my AES and SHA code, both of which are maintained (and can be found in my repository here). SInce the current SHA code can use both SHA1 and SHA2 I had to make changes in the fileenc code to accommodate this change (note also the addition of sha2.h and sha2.c).

If you wish to continue with the old code, you can now track down and find the issue that causes it to fail by running both the old and the new versions in debuggers to find the point at which the SHA1 code in the old version does not match the data in the new version. I may then be able to change the old SHA1 code to avoid the error that occurs with Linux/GCC.

from aes.

tajiknomi avatar tajiknomi commented on July 18, 2024

Thank you BrianGladman. I will let you know once i found the cause of the issue in previous SHA1 implementation.

from aes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.