Skip to content
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

Initial vertcoin support #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ProxyPool/Mining.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import qualified Crypto.Hash.SHA256 as S

#include "scrypt.h"

foreign import ccall "scrypt_N_1_1_256" c_nfactorscrypt :: Ptr CChar -> Ptr CChar -> IO ()
foreign import ccall "scrypt_1024_1_1_256" c_scrypt :: Ptr CChar -> Ptr CChar -> IO ()

data Work
Expand Down Expand Up @@ -99,7 +100,7 @@ getPOW _ _ _ _ _ = 0
scrypt :: B.ByteString -> Integer
scrypt header = unsafePerformIO $ do
packed <- allocaBytes 32 $ \result -> do
B.unsafeUseAsCString header $ flip c_scrypt result
B.unsafeUseAsCString header $ flip c_nfactorscrypt result
B.packCStringLen (result, 32)

return . unpackIntLE $ packed
Expand Down
15 changes: 15 additions & 0 deletions include/nfactorscrypt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef SCRYPT_H
#define SCRYPT_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif

void scrypt_N_1_1_256(const char* input, char* output);
void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t N);

#ifdef __cplusplus
}
#endif

#endif
2 changes: 1 addition & 1 deletion proxypool.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build-type: Simple
cabal-version: >=1.10

library
c-sources: scrypt/scrypt.c
c-sources: scrypt/scrypt.c scrypt/nfactorscrypt.c
cc-options: -Wall -std=c99
include-dirs: include
ghc-options: -Wall -threaded
Expand Down
Loading