Skip to content

Instantly share code, notes, and snippets.

View nabe33's full-sized avatar

Takayuki Watanabe nabe33

View GitHub Profile
@nabe33
nabe33 / about_zkrepl.md
Last active July 27, 2024 00:29 — forked from NOOMA-42/about_zkrepl.md
circom circuit to add 2 numbers on an elliptic curve

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:1a9040d49a0a828075971cb50acc4adb";

@nabe33
nabe33 / main.circom
Created July 27, 2024 00:17
Circom練習:input to hash
pragma circom 2.1.6;
// Poseidonハッシュ関数のインポート
include "circomlib/poseidon.circom";
template HashProof() {
// 入力と出力の宣言
signal input preimage;
signal input expectedHash;
signal output isValid;
@nabe33
nabe33 / main_mul3.circom
Last active July 26, 2024 23:33
Circom練習:3つの数の乗算
pragma circom 2.1.6;
template Mul3numProof() {
// declaration of signals
signal input a;
signal input b;
signal input c;
signal output result;
// constraint
@nabe33
nabe33 / calc.js
Created July 25, 2024 06:44
Modular Arithmetic Calculator
function modularCalculator(op, num1, num2, mod) {
if (op == "+") {
var result = ((num1 % mod) + (num2 % mod)) % mod;
return result;
}
else if(op == "-") {
console.log("(num1 % mod) - (num2 % mod) = " + ((num1 % mod) - (num2 % mod)) % mod);
var result = ((num1 % mod) - (num2 % mod)) % mod;
if ( result < 0) result += mod;
return result;
@nabe33
nabe33 / index.html
Created July 23, 2024 06:32
Fast Modular Exponentiation
<!DOCTYPE html>
<html>
<head>
<title>Fast Modular Exponentiation</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.result {
@nabe33
nabe33 / main.dart
Created March 23, 2024 08:19
HooksとRiverpodを使う例
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final counterProvider = StateProvider<int>((ref) => 0);
void main() {
runApp(
@nabe33
nabe33 / main.dart
Last active February 4, 2024 11:52
StatelessWidgetの例
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@nabe33
nabe33 / main.dart
Last active March 23, 2024 08:17
StatefulWidgetの例
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
@nabe33
nabe33 / main.dart
Last active February 4, 2024 03:07
Dartの練習1
void main() {
List<String> vowels = ['a', 'e', 'i', 'o', 'u'];
String string = 'Jksced';
String answer = 'no';
for (int i = 0; i < string.length; i++) {
for (int j = 0; j < vowels.length; j++) {
print('i=$i (${string[i]}), j=$j (${vowels[j]})');
if (string[i].toLowerCase() == vowels[j]) {
// 大文字と小文字を区別しない比較
@nabe33
nabe33 / 0_reuse_code.js
Created April 6, 2016 07:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console