Git Product home page Git Product logo

Comments (9)

satvikc avatar satvikc commented on July 28, 2024

I am not sure how to refactor Hash.hs and MAC.hs for the new Gadget interface. Can you give some guide lines for the same.

from raaz.

piyush-kurur avatar piyush-kurur commented on July 28, 2024

On Tue, Aug 20, 2013 at 04:07:35AM -0700, satvikc wrote:

I am not sure how to refactor Hash.hs and MAC.hs for the new Gadget interface. Can you give some guide lines for the same.

We can discuss this in person sometime.

Regards

ppk

from raaz.

satvikc avatar satvikc commented on July 28, 2024

I have rewritten the Hash and MAC but I ran into few problems

  • I am not sure how to define finalize for HMAC g as I require outer pad and I have no way of getting that from HMAC g.
  • Also I had to add a function reInitialize :: g -> PrimitiveOf g -> IV (PrimitiveOf g) in HashGadget to make rest of the HMAC work.

You can look at the code here

from raaz.

piyush-kurur avatar piyush-kurur commented on July 28, 2024

On Thu, Aug 22, 2013 at 11:39:58AM -0700, satvikc wrote:

I have rewritten the Hash and MAC but I ran into few problems

  • I am not sure how to define finalize for HMAC g as I require outer pad and I have no way of getting that from HMAC g.

Define IV (HMAC h) = (IV h, IV h)

The IV (HMAC h) should be (IV h, IV h). The first IV h is for the
inner pad (i.e. hash of the inner pad) and the second for the IV of
the outer pad. You might need to store the IV h inside a memory
element so you might need some storable or something like that
instance.

Regards

ppk

from raaz.

satvikc avatar satvikc commented on July 28, 2024

the type of finalize is g -> IO (PrimitiveOf g. And I have no way of
inspecting the memory component of g.

On Fri, Aug 23, 2013 at 10:14 AM, Piyush P Kurur
[email protected]:

On Thu, Aug 22, 2013 at 11:39:58AM -0700, satvikc wrote:

I have rewritten the Hash and MAC but I ran into few problems

  • I am not sure how to define finalize for HMAC g as I require outer
    pad and I have no way of getting that from HMAC g.

Define IV (HMAC h) = (IV h, IV h)

The IV (HMAC h) should be (IV h, IV h). The first IV h is for the
inner pad (i.e. hash of the inner pad) and the second for the IV of
the outer pad. You might need to store the IV h inside a memory
element so you might need some storable or something like that
instance.

Regards

ppk


Reply to this email directly or view it on GitHubhttps://github.com/piyush-kurur/raaz/issues/54#issuecomment-23143189
.


Satvik Chauhan
Fourth Year Under Graduate Student
Deptt. of Computer Science and Engineering
Indian Institute of Technology Kanpur
Kanpur-208016, INDIA
Email: [email protected] , [email protected]


from raaz.

satvikc avatar satvikc commented on July 28, 2024

CryptoArray doesn't have a memory instance.

MemoryOf g has Memory typeclass constraint, so I can put neither CryptoArray nor ForeignCryptoPtr directly into MemoryOf (HMACGadget g). The only solution which I could think of is to define a newtype with a Memory instance.

from raaz.

satvikc avatar satvikc commented on July 28, 2024

I have refactored the code using the above solution. I am not sure how to solve the following error from

instance CryptoPrimitive p => CryptoPrimitive (HMAC p) where
  type Recommended (HMAC p) = HMAC (Recommended p)
  type Reference   (HMAC p) = HMAC (Reference p)
Raaz/Primitives/Hash.hs:250:10:
    Could not deduce (PrimitiveOf (HMAC (Recommended p)) ~ HMAC p)
    from the context (CryptoPrimitive p)
      bound by the instance declaration
      at Raaz/Primitives/Hash.hs:250:10-54
    In the instance declaration for `CryptoPrimitive (HMAC p)'

Adding that to the type forces to use undecidableinstances which I dont want to use.

from raaz.

satvikc avatar satvikc commented on July 28, 2024

I have refactored the code but tests are failing. I am not sure where the bug is. But it is happening because of some garbage as the hash on the same string is giving different values each time.

from raaz.

piyush-kurur avatar piyush-kurur commented on July 28, 2024

The interface is no more relevant I am closing this issue

from raaz.

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.