mirror of
https://github.com/MAGICGrants/flutter_libsparkmobile.git
synced 2026-01-08 20:47:56 -05:00
fix string length
This commit is contained in:
@@ -542,11 +542,7 @@ abstract final class LibSpark {
|
|||||||
return hashes;
|
return hashes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [x] and [y] must be of length 64
|
|
||||||
static String hashTag(String x, String y) {
|
static String hashTag(String x, String y) {
|
||||||
assert(x.length == 64);
|
|
||||||
assert(y.length == 64);
|
|
||||||
|
|
||||||
final xPtr = x.toNativeUtf8().cast<Char>();
|
final xPtr = x.toNativeUtf8().cast<Char>();
|
||||||
final yPtr = y.toNativeUtf8().cast<Char>();
|
final yPtr = y.toNativeUtf8().cast<Char>();
|
||||||
|
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ const char* hashTag(const char* x, const char* y) {
|
|||||||
secp_primitives::GroupElement tag = secp_primitives::GroupElement(x, y, 16);
|
secp_primitives::GroupElement tag = secp_primitives::GroupElement(x, y, 16);
|
||||||
uint256 hash = primitives::GetLTagHash(tag);
|
uint256 hash = primitives::GetLTagHash(tag);
|
||||||
std::string hex = hash.GetHex();
|
std::string hex = hash.GetHex();
|
||||||
char* result = (char*) malloc(sizeof(char) * hex.length());
|
char* result = (char*) malloc(sizeof(char) * (hex.length() + 1));
|
||||||
strcpy(result, hex.c_str());
|
strcpy(result, hex.c_str());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user