mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Merge pull request #410 from gkanwar/photon_and_sha_patches
Photon.h and SHA256 patches
This commit is contained in:
commit
913fbca74a
@ -49,7 +49,7 @@ NAMESPACE_BEGIN(Grid);
|
|||||||
|
|
||||||
typedef Lattice<SiteLink> LinkField;
|
typedef Lattice<SiteLink> LinkField;
|
||||||
typedef Lattice<SiteField> Field;
|
typedef Lattice<SiteField> Field;
|
||||||
typedef Field ComplexField;
|
typedef LinkField ComplexField;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QedGImpl<vComplex> QedGImplR;
|
typedef QedGImpl<vComplex> QedGImplR;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
#include <openssl/evp.h>
|
||||||
}
|
}
|
||||||
#ifdef USE_IPP
|
#ifdef USE_IPP
|
||||||
#include "ipp.h"
|
#include "ipp.h"
|
||||||
@ -70,10 +71,8 @@ public:
|
|||||||
static inline std::vector<unsigned char> sha256(const void *data,size_t bytes)
|
static inline std::vector<unsigned char> sha256(const void *data,size_t bytes)
|
||||||
{
|
{
|
||||||
std::vector<unsigned char> hash(SHA256_DIGEST_LENGTH);
|
std::vector<unsigned char> hash(SHA256_DIGEST_LENGTH);
|
||||||
SHA256_CTX sha256;
|
auto digest = EVP_get_digestbyname("SHA256");
|
||||||
SHA256_Init (&sha256);
|
EVP_Digest(data, bytes, &hash[0], NULL, digest, NULL);
|
||||||
SHA256_Update(&sha256, data,bytes);
|
|
||||||
SHA256_Final (&hash[0], &sha256);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
static inline std::vector<int> sha256_seeds(const std::string &s)
|
static inline std::vector<int> sha256_seeds(const std::string &s)
|
||||||
|
@ -793,6 +793,7 @@ int main (int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
std::cout <<" OK ! "<<std::endl;
|
std::cout <<" OK ! "<<std::endl;
|
||||||
|
|
||||||
|
#ifdef USE_FP16
|
||||||
// Double to Half
|
// Double to Half
|
||||||
std::cout << GridLogMessage<< "Double to half" ;
|
std::cout << GridLogMessage<< "Double to half" ;
|
||||||
precisionChange(&H[0],&D[0],Ndp);
|
precisionChange(&H[0],&D[0],Ndp);
|
||||||
@ -822,6 +823,7 @@ int main (int argc, char ** argv)
|
|||||||
assert( tmp < 1.0e-3 );
|
assert( tmp < 1.0e-3 );
|
||||||
}
|
}
|
||||||
std::cout <<" OK ! "<<std::endl;
|
std::cout <<" OK ! "<<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
|
Loading…
Reference in New Issue
Block a user