Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove pedersen_buffer_to_field from c_bind #3045

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,4 @@ WASM_EXPORT void pedersen___commit(fr::vec_in_buf inputs_buffer, fr::out_buf out

serialize::write(output, pedersen_hash);
}

WASM_EXPORT void pedersen___buffer_to_field(uint8_t const* data, fr::out_buf r)
{
std::vector<uint8_t> to_compress;
read(data, to_compress);
auto output = crypto::pedersen_hash::hash_buffer(to_compress);
write(r, output);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ WASM_EXPORT void pedersen___compress_with_hash_index(fr::vec_in_buf inputs_buffe
fr::out_buf output);

WASM_EXPORT void pedersen___commit(fr::vec_in_buf inputs_buffer, fr::out_buf output);

WASM_EXPORT void pedersen___buffer_to_field(uint8_t const* data, fr::out_buf r);
}
16 changes: 0 additions & 16 deletions barretenberg/exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,6 @@
],
"isAsync": false
},
{
"functionName": "pedersen___buffer_to_field",
"inArgs": [
{
"name": "data",
"type": "const uint8_t *"
}
],
"outArgs": [
{
"name": "r",
"type": "fr::out_buf"
}
],
"isAsync": false
},
{
"functionName": "pedersen_hash_init",
"inArgs": [],
Expand Down
5 changes: 0 additions & 5 deletions barretenberg/ts/src/barretenberg_api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ export class BarretenbergApi {
return result[0];
}

async pedersenBufferToField(data: Uint8Array): Promise<Fr> {
const result = await this.binder.callWasmExport('pedersen___buffer_to_field', [data], [Fr]);
return result[0];
}

async pedersenHashInit(): Promise<void> {
const result = await this.binder.callWasmExport('pedersen_hash_init', [], []);
return;
Expand Down
7 changes: 0 additions & 7 deletions barretenberg/ts/src/barretenberg_api/pedersen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ describe('pedersen', () => {
expect(result).toEqual(new Fr(18374309251862457296563484909553154519357910650678202211610516068880120638872n));
});

it('pedersenBufferToField', async () => {
const result = await api.pedersenBufferToField(
Buffer.from('Hello world! I am a buffer to be converted to a field!'),
);
expect(result).toEqual(new Fr(5836632387256708040349959803326023895450290698906238002955147410646852307074n));
});

it('pedersenHashPair', async () => {
const result = await api.pedersenHashPair(new Fr(4n), new Fr(8n));
expect(result).toEqual(new Fr(1521373897829389584529155077412196627698249315427143054350987371861781120260n));
Expand Down