cocos_js/cocos/scrypt/native-crypto.cpp
2022-07-12 20:50:40 +08:00

27 lines
606 B
C++

/*
* Copyright (c) 2014, Airbitz, Inc.
* All rights reserved.
*
* See the LICENSE file for more information.
*/
#include "native-crypto.h"
extern "C" {
#include "crypto_scrypt.h"
}
#include <math.h>
#include <stdlib.h>
#include <string.h>
#define COMPRESSED_PUBKEY_LENGTH 33
#define DECOMPRESSED_PUBKEY_LENGTH 65
#define PRIVKEY_LENGTH 64
int fast_crypto_scrypt (const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, size_t saltlen, uint64_t N,
uint32_t r, uint32_t p, uint8_t *buf, size_t buflen)
{
return crypto_scrypt(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen);
}