Skip to content

Commit 875793d

Browse files
makxenovnkaskov
authored andcommitted
Add example with string public input
1 parent 655734b commit 875793d

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ add_example(pallas_curve_addition_example
7474
# SOURCES pallas_curve_examples/pallas_curve_mul_add.cpp
7575
# INPUT pallas_curve_examples/pallas_curve_mul_add.inp)
7676
add_example(ed25519_curve_add SOURCES ed25519_curve_add.cpp INPUT ed25519_curve_add.inp)
77+
add_example(strlen_example SOURCES strlen.cpp INPUT strlen.inp)

examples/strlen.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <cstddef>
2+
[[circuit]] size_t strlen(const char *str) {
3+
size_t counter = 0;
4+
while (str[counter++] != '\0');
5+
return counter - 1;
6+
}

examples/strlen.inp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[ {"string": "abcdefgh"}]

0 commit comments

Comments
 (0)