Example #1
0
std::string crypt_plugin::generate( ) 
{
   std::string name = config->getString("core.algo");
   unsigned short len = config->getInt("core.length");
   if( name == "Blowfish")  {
     return do_crypto(len);
   } else if( name == "Sha-256")  {
     return do_sha(256,len);
   } else if( name == "Sha-512")  {
     return do_sha(512,len);
   }
   return "System Error - unknown algo ";
}
Example #2
0
int main(){
	int i;
	for(i=0; i < 1; i++){
		do_sha();
		do_gpu_sha();
	}

	return 0;
}
Example #3
0
static crypto_result_type
crypto_sha1(unsigned char *buff_ptr,
	    unsigned int buff_size, unsigned char *digest_ptr)
{
	crypto_result_type ret_val = CRYPTO_SHA_ERR_NONE;

	if ((!buff_size) || (buff_ptr == NULL) || (digest_ptr == NULL)) {
		return CRYPTO_SHA_ERR_INVALID_PARAM;
	}

	/* Initialize crypto engine hardware for a new SHA1 operation */
	crypto_init();

	/* Now do SHA1 hashing */
	ret_val = do_sha(buff_ptr, buff_size, digest_ptr, CRYPTO_AUTH_ALG_SHA1);

	if (ret_val != CRYPTO_SHA_ERR_NONE) {
		dprintf(CRITICAL, "crypto_sha256 returns error %d\n", ret_val);
	}

	return ret_val;
}