Zkproof CLI Guide
Prerequisites
Preprocessing Text
{
"text": [...],
"subtext": [...]
}function convertToByteArray(strToConvert) {
let byte_arr = [];
for (let i = 0; i < strToConvert.length; i++) {
let code = strToConvert.charCodeAt(i);
byte_arr.push(code);
}
return byte_arr
}
function byteArrayToBigInt(byteArray) {
return BigInt('0x' + Array.from(byteArray, function (byte) {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join(''));
}
function textToBigIntChunks(text) {
text = text.substr(0, 15872);
const textBytes = convertToByteArray(text)
const paddedBytes = new Uint8Array(15872);
paddedBytes.set(textBytes);
const chunkSize = 31;
const chunks = [];
for (let i = 0; i < paddedBytes.length; i += chunkSize) {
const chunk = paddedBytes.subarray(i, i + chunkSize);
const chunkBigInt = byteArrayToBigInt(chunk);
chunks.push(chunkBigInt);
}
return chunks;
}Generating Proof
Verifying Proof
Last updated