-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a type parameters that capture an implemention #41
Comments
|
On Thu, Apr 11, 2013 at 07:57:28PM -0700, satvikc wrote:
Should this be type family instead of data family ? Imagin the following situation: Say sha1 and sha256 has only reference type instance DefaultImplementation SHA1 = Reference
type instance DefaultImplementation SHA256 = Reference
If we use data family we might have something like data instance DefaultImplementation SHA1 = SHA1Implementation Reference
data instance DefaultImplementation SHA256 = SHA256Implementation Reference
This issue here is of
We probably need to try both out and figure out. |
Can you try finishing this work ? |
I have added the Implementation class in Raaz.Primitives and divided the corresponding functions of hash in Raaz.Hash but I am not sure about the Mac code to make it work with any implementation because I can not add something like |
On Fri, May 24, 2013 at 05:44:19PM -0700, satvikc wrote: The current code seems not correct to me. class HasBlockSize p where
blockSize :: p -> Int
class (Show i, HasBlockSize p) => BlockImplementation i p where
data Cxt i p
process :: Cxt i p
-> Blocks p
-> ....
...
recomendedBlocks :: i -> p -> Blocks p
class ( HasBlockSize p,
, BlockImplementation (DefaultImplementation p) p
) => BlockPrimitive p where
type DefaultImplementation p :: *
---- In hash we have
class ( HasPadding h
, Eq h
, Storable h
, CryptoStore h
, HasBlockSize p
, BlockImplementation i h
) => HashImplemenation i h where
there will be an extra i sitting out
class ( BlockPrimitive h, HashImplementation (DefaultImplementation h) h)
=> Hash h where
Then I guess you can fix the Mac also. Further you will not need to do Regards ppk |
The github issue tracker is irritating. It cannot handle email based response. By the way if you can think of better names for the classes involved that would be nice. |
See the modified changes. I am still not sure how to get rid of |
I think you can avoid the associated type families DefaultHashImplementation and DefaultMacImplementation. You can instead have. class (BlockPrimitive h, HashImplementation (DefaultBlockImplemenation h) h) => Hash h where
This forces that the I hate classes with no member function but I think in this case it makes sense to have this. The class Maybe we can immediately and an instance declaration and be done with it. And similarly for Mac |
We can have that, but I am still not sure how to get rid of Scoped type variables. Like in this what should I do??
|
On Sun, May 26, 2013 at 06:14:00PM -0700, satvikc wrote:
What is the error message for hash :: ( Hash h, ByteSource src ) => src -> IO h |
|
On Mon, May 27, 2013 at 05:32:41AM -0700, satvikc wrote:
Okey I see. Try the following. hash src = hash'' underfined src Regards ppk |
Raaz/Hash.hs:130:27: On Mon, May 27, 2013 at 8:50 AM, Piyush P Kurur notifications@github.comwrote:
Satvik Chauhan |
On Mon, May 27, 2013 at 05:52:47AM -0700, satvikc wrote:
Do you have the constraint HashImplementation (DefaultBlockImplementation h) in the definition of Regards ppk |
Yes, You can look the current code at On Mon, May 27, 2013 at 8:58 AM, Piyush P Kurur notifications@github.comwrote:
Satvik Chauhan |
On Mon, May 27, 2013 at 06:07:37AM -0700, satvikc wrote:
I have edited the Hash file and now it does not use scoped type Regards ppk |
I did attach the updated Raaz.Hash file. I am sending a separate mail to your cse account if you did not get the attachment. |
Is there a reason you changed the implementation of |
On Wed, May 29, 2013 at 01:26:26AM -0700, satvikc wrote:
I thought the code was simpler. Regards ppk |
The library should support the following usecases
(1) There should be a straight forward way to perform a crypto primitive that uses the autotuned implementation
(2) There should be a way to call a specific implementation of a crypto primitive.
The use case (2) is required to support for example benchmarking different implementation and also to avoid use of certain hardware (for example on a desktop one might want to spare the graphics card for actual graphics operation than crypto operations, which requires avoiding implementations like CUDA for example)
The text was updated successfully, but these errors were encountered: