From 6a59ca023e4bef10f1f4f1eea3903ccdecea2d5e Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 7 Jun 2017 05:32:43 +0900 Subject: add blsIdSetInt --- include/bls/bls.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'include/bls') 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); @@ -115,17 +128,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); -- cgit v1.2.3