diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2017-06-07 04:32:43 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2017-06-07 04:32:43 +0800 |
commit | 6a59ca023e4bef10f1f4f1eea3903ccdecea2d5e (patch) | |
tree | 0b71303dd490e8d37017a3d4ddf6dc69380638d7 /include | |
parent | 4fcee45075236077da84982b09ad2133da06497d (diff) | |
download | dexon-bls-6a59ca023e4bef10f1f4f1eea3903ccdecea2d5e.tar.gz dexon-bls-6a59ca023e4bef10f1f4f1eea3903ccdecea2d5e.tar.zst dexon-bls-6a59ca023e4bef10f1f4f1eea3903ccdecea2d5e.zip |
add blsIdSetInt
Diffstat (limited to 'include')
-rw-r--r-- | include/bls/bls.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/include/bls/bls.h b/include/bls/bls.h index 32fdd7f..97bd5e7 100644 --- a/include/bls/bls.h +++ b/include/bls/bls.h @@ -56,6 +56,19 @@ BLS_DLL_API size_t blsGetOpUnitSize(void); BLS_DLL_API int blsGetCurveOrder(char *buf, size_t maxBufSize); BLS_DLL_API int blsGetFieldOrder(char *buf, size_t maxBufSize); +BLS_DLL_API void blsIdSetInt(blsId *id, int x); +// return 0 if success +BLS_DLL_API int blsIdSetDecStr(blsId *id, const char *buf, size_t bufSize); +BLS_DLL_API int blsIdSetHexStr(blsId *id, const char *buf, size_t bufSize); + +/* + return strlen(buf) if success else 0 + buf is '\0' terminated +*/ +BLS_DLL_API size_t blsIdGetDecStr(char *buf, size_t maxBufSize, const blsId *id); +BLS_DLL_API size_t blsIdGetHexStr(char *buf, size_t maxBufSize, const blsId *id); + + // return written byte size if success else 0 BLS_DLL_API size_t blsIdSerialize(void *buf, size_t maxBufSize, const blsId *id); BLS_DLL_API size_t blsSecretKeySerialize(void *buf, size_t maxBufSize, const blsSecretKey *sec); @@ -116,17 +129,6 @@ BLS_DLL_API int blsIdSetLittleEndian(blsId *id, const void *buf, size_t bufSize) BLS_DLL_API size_t blsIdGetLittleEndian(void *buf, size_t maxBufSize, const blsId *id); // return 0 if success -BLS_DLL_API int blsIdSetDecStr(blsId *id, const char *buf, size_t bufSize); -BLS_DLL_API int blsIdSetHexStr(blsId *id, const char *buf, size_t bufSize); - -/* - return strlen(buf) if success else 0 - buf is '\0' terminated -*/ -BLS_DLL_API size_t blsIdGetDecStr(char *buf, size_t maxBufSize, const blsId *id); -BLS_DLL_API size_t blsIdGetHexStr(char *buf, size_t maxBufSize, const blsId *id); - -// return 0 if success // mask buf with (1 << (bitLen(r) - 1)) - 1 if buf >= r BLS_DLL_API int blsSecretKeySetLittleEndian(blsSecretKey *sec, const void *buf, size_t bufSize); BLS_DLL_API int blsSecretKeySetDecStr(blsSecretKey *sec, const char *buf, size_t bufSize); |