repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/b.rs | ch05/mod_ex2/src/b.rs | mod b_1;
mod b_2;
struct TypeB;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/main.rs | ch05/mod_ex2/src/main.rs | mod a;
mod b;
fn main() {}
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/a.rs | ch05/mod_ex2/src/a.rs | mod a_1;
mod a_2;
struct TypeA;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/a/a_2.rs | ch05/mod_ex2/src/a/a_2.rs | struct TypeA2;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/a/a_1.rs | ch05/mod_ex2/src/a/a_1.rs | struct TypeA1;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/b/b_1.rs | ch05/mod_ex2/src/b/b_1.rs | struct TypeB1;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex2/src/b/b_2.rs | ch05/mod_ex2/src/b/b_2.rs | struct TypeB2;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/visibility/src/main.rs | ch05/visibility/src/main.rs | mod a {
struct TypeA {
// a1: a_1::TypeA1, // エラー。子のプライベートな要素は見えない
a2: Box<a_2::TypeA2>, // 子のパブリックな要素は見える
}
mod a_1 {
struct TypeA1 {
// 親が見えるものは見える
a: Box<super::TypeA>,
a2: Box<super::a_2::TypeA2>,
}
}
mod a_2 {
pub str... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/markdown/src/lib.rs | ch05/markdown/src/lib.rs | //! # 第一見出し
//!
//! テキストを書く。
//!
//! ## 第二見出し
//!
//! ### 第三見出し
//!
//! - 箇条書き1
//! - 箇条書き2
//!
//! 1. 番号付きリスト1
//! 2. 番号付きリスト2
//!
//! > 引用
//! > 文字列
//!
//! [KSPUB](https://www.kspub.co.jp/)
//!
//! `println!("Hello, world!");`
//!
//! ```
//! println!("Hello, world!");
//! ```
//!
mod my_module {
//! これはモジュールのド... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch04/serialize/src/main.rs | ch04/serialize/src/main.rs | use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
enum List<T> {
Node { data: T, next: Box<List<T>> },
Nil,
}
impl<T> List<T> {
fn new() -> List<T> {
List::Nil
}
/// リストを消費して、そのリストの先頭にdataを追加したリストを返す
fn cons(self, data: T) -> List<T> {
List::... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch04/display/src/main.rs | ch04/display/src/main.rs | fn main() {
use std::fmt::{Display, Formatter};
/// 虚数を表す型
struct ImaginaryNumber {
real: f64,
img: f64,
}
/// 虚数を表示するため、Displayトレイトを実装
impl Display for ImaginaryNumber {
fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> {
write!(f, "{} + {}i",... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch04/iter/src/main.rs | ch04/iter/src/main.rs | use std::iter::Iterator;
/// リストを表す型
#[derive(Debug, Clone)]
enum List<T> {
Node { data: T, next: Box<List<T>> },
Nil,
}
impl<T> List<T> {
fn new() -> List<T> {
List::Nil
}
/// リストを消費して、そのリストの先頭にdataを追加したリストを返す
fn cons(self, data: T) -> List<T> {
List::Node {
data,... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/engine.rs | ch06/regex/src/engine.rs | //! 正規表現エンジン
mod codegen;
mod evaluator;
mod parser;
use crate::helper::DynError;
use std::fmt::{self, Display};
/// 命令列
#[derive(Debug)]
pub enum Instruction {
Char(char),
Match,
Jump(usize),
Split(usize, usize),
}
impl Display for Instruction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/lib.rs | ch06/regex/src/lib.rs | //! # 正規表現エンジン用クレート。
//!
//! ## 利用例
//!
//! ```
//! use regex;
//! let expr = "a(bc)+|c(def)*"; // 正規表現
//! let line = "cdefdefdef"; // マッチ対象文字列
//! regex::do_matching(expr, line, true); // 幅優先探索でマッチング
//! regex::print(expr); // 正規表現のASTと命令列を表示
//! ```
mod engine;
mod helper;
pub use engine::{do_matching, print};
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/helper.rs | ch06/regex/src/helper.rs | pub trait SafeAdd: Sized {
fn safe_add(&self, n: &Self) -> Option<Self>;
}
impl SafeAdd for usize {
fn safe_add(&self, n: &Self) -> Option<Self> {
self.checked_add(*n)
}
}
pub fn safe_add<T, F, E>(dst: &mut T, src: &T, f: F) -> Result<(), E>
where
T: SafeAdd,
F: Fn() -> E,
{
if let Som... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/main.rs | ch06/regex/src/main.rs | mod engine;
mod helper;
use helper::DynError;
use std::{
env,
fs::File,
io::{BufRead, BufReader},
};
fn main() -> Result<(), DynError> {
let args: Vec<String> = env::args().collect();
if args.len() <= 2 {
eprintln!("usage: {} regex file", args[0]);
return Err("invalid arguments".in... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/engine/parser.rs | ch06/regex/src/engine/parser.rs | //! 正規表現の式をパースし、抽象構文木に変換
use std::{
error::Error,
fmt::{self, Display},
mem::take,
};
/// パースエラーを表すための型
#[derive(Debug)]
pub enum ParseError {
InvalidEscape(usize, char), // 誤ったエスケープシーケンス
InvalidRightParen(usize), // 左開き括弧無し
NoPrev(usize), // +、|、*、?の前に式がない
NoRightParen, ... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/engine/codegen.rs | ch06/regex/src/engine/codegen.rs | //! ASTからコード生成を行う
use super::{parser::AST, Instruction};
use crate::helper::safe_add;
use std::{
error::Error,
fmt::{self, Display},
};
/// コード生成エラーを表す型
#[derive(Debug)]
pub enum CodeGenError {
PCOverFlow,
FailStar,
FailOr,
FailQuestion,
}
impl Display for CodeGenError {
fn fmt(&self, f: &... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/src/engine/evaluator.rs | ch06/regex/src/engine/evaluator.rs | //! 命令列と入力文字列を受け取り、マッチングを行う
use super::Instruction;
use crate::helper::safe_add;
use std::{
collections::VecDeque,
error::Error,
fmt::{self, Display},
};
#[derive(Debug)]
pub enum EvalError {
PCOverFlow,
SPOverFlow,
InvalidPC,
InvalidContext,
}
impl Display for EvalError {
fn fmt(&self... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch06/regex/benches/benchmark.rs | ch06/regex/benches/benchmark.rs | //! # パフォーマンス計測
//!
//! ## 計測方法
//! a?^n a^nという正規表現を、a^nという文字列にマッチさせる。
//! ただし、a?^nとa^nは、a?とaのn回の繰り返し。
//! 計測は幅優先と深さ優先で行う。
//!
//! ## n = 3の場合の例
//!
//! - 正規表現: a?a?a?aaa
//! - str: aaa
//!
//! ## 実行方法
//!
//! cargo-criterionをインストール後、cargo criterionと実行。
//!
//! ```text
//! $ cargo install cargo-criterion
//! $ cargo cr... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch02/sort/src/main.rs | ch02/sort/src/main.rs | //! 実行すると5GB以上のメモリを消費するため注意すること。
//! メモリが足りない場合は、NUMの値を減らしてください。
const NUM: usize = 200000000; // 生成する乱数の合計数
/// xorshift
struct XOR64 {
x: u64,
}
impl XOR64 {
fn new(seed: u64) -> XOR64 {
XOR64 {
x: seed ^ 88172645463325252,
}
}
/// 乱数生成関数
fn next(&mut self) -> u64 {... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch03/rwlock/src/main.rs | ch03/rwlock/src/main.rs | use std::{
collections::BTreeMap,
sync::{Arc, RwLock},
thread::sleep,
time::Duration,
};
fn main() {
// 美術館を初期化
let mut gallery = BTreeMap::new();
gallery.insert("葛飾北斎", "富嶽三十六景 神奈川沖浪裏");
gallery.insert("ミュシャ", "黄道十二宮");
// RwLockとArcを利用して共有可能に
let gallery = Arc::new(RwLock::ne... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch08/ackerman/src/main.rs | ch08/ackerman/src/main.rs | //! アッカーマン関数
use num::{BigUint, FromPrimitive, One, Zero};
const M: usize = 4;
const N: usize = 4;
fn main() {
let m = M;
let n = BigUint::from_usize(N).unwrap();
let a = ackerman(m, n.clone());
println!("ackerman({M}, {N}) = {a}");
}
fn ackerman(m: usize, n: BigUint) -> BigUint {
let one: BigUi... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch08/ackerman/src/ackerman_tailcall.rs | ch08/ackerman/src/ackerman_tailcall.rs | //! 末尾呼び出し版のアッカーマン関数実装
use num::{BigUint, One, Zero};
#[derive(Debug, Clone)]
pub enum N {
VAL(BigUint),
A(usize, BigUint),
}
impl N {
fn get(self) -> BigUint {
match self {
N::VAL(n) => n,
N::A(m, n) => ackerman_tail(m, N::VAL(n)),
}
}
}
pub fn ackerman(m: us... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch08/dbg_target/src/main.rs | ch08/dbg_target/src/main.rs | use std::arch::asm;
use nix::{
sys::signal::{kill, Signal},
unistd::getpid,
};
fn main() {
println!("int 3");
unsafe { asm!("int 3") };
println!("kill -SIGTRAP");
let pid = getpid();
kill(pid, Signal::SIGTRAP).unwrap();
for i in 0..3 {
unsafe { asm!("nop") };
println!... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch08/zdbg/src/dbg.rs | ch08/zdbg/src/dbg.rs | use crate::helper::DynError;
use nix::{
libc::user_regs_struct,
sys::{
personality::{self, Persona},
ptrace,
wait::{waitpid, WaitStatus},
},
unistd::{execvp, fork, ForkResult, Pid},
};
use std::ffi::{c_void, CString};
/// デバッガ内の情報
pub struct DbgInfo {
pid: Pid,
brk_addr:... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch08/zdbg/src/helper.rs | ch08/zdbg/src/helper.rs | pub type DynError = Box<dyn std::error::Error + Send + Sync + 'static>;
| rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
ytakano/rust_zero | https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch08/zdbg/src/main.rs | ch08/zdbg/src/main.rs | mod dbg;
mod helper;
use dbg::{State, ZDbg};
use helper::DynError;
use rustyline::{error::ReadlineError, Editor};
use std::env;
fn main() -> Result<(), DynError> {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
let msg = format!("引数が必要です\n例 : {} 実行ファイル [引数*]", args[0]);
ret... | rust | MIT | 843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c | 2026-01-04T20:20:39.285647Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/lib.rs | src/lib.rs | #![no_std]
#![crate_name = "elfloader"]
#![crate_type = "lib"]
#[cfg(test)]
#[macro_use]
extern crate std;
#[cfg(test)]
extern crate env_logger;
mod binary;
pub use binary::ElfBinary;
pub mod arch;
pub use arch::RelocationType;
use core::fmt;
use core::iter::Filter;
use bitflags::bitflags;
use xmas_elf::dynamic::*... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/binary.rs | src/binary.rs | use crate::{
DynamicFlags1, DynamicInfo, ElfLoader, ElfLoaderErr, LoadableHeaders, RelocationEntry,
RelocationType,
};
use core::fmt;
#[cfg(log)]
use log::*;
use xmas_elf::dynamic::Tag;
use xmas_elf::program::ProgramHeader::{self, Ph32, Ph64};
use xmas_elf::program::{ProgramIter, SegmentData, Type};
use xmas_el... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/test.rs | src/arch/test.rs | use crate::*;
use log::{info, trace};
use std::vec::Vec;
#[derive(Eq, Clone, PartialEq, Copy, Debug)]
pub(crate) enum LoaderAction {
Allocate(VAddr, usize, Flags),
Load(VAddr, usize),
Relocate(VAddr, u64),
Tls(VAddr, u64, u64, u64),
}
pub(crate) struct TestLoader {
pub(crate) vbase: VAddr,
pub(... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/mod.rs | src/arch/mod.rs | use crate::{ElfLoaderErr, Machine};
pub mod aarch64;
pub mod arm;
pub mod riscv;
pub mod x86;
pub mod x86_64;
#[cfg(test)]
mod test;
#[derive(Debug)]
#[allow(non_camel_case_types)]
pub enum RelocationType {
x86(x86::RelocationTypes),
x86_64(x86_64::RelocationTypes),
Arm(arm::RelocationTypes),
AArch64... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/riscv/test.rs | src/arch/riscv/test.rs | use std::fs;
use crate::arch::test::*;
use crate::*;
#[test]
fn load_pie_elf() {
init();
let binary_blob = fs::read("test/test.riscv64").expect("Can't read binary");
let binary = ElfBinary::new(binary_blob.as_slice()).expect("Got proper ELF file");
assert!(binary.is_pie());
let mut loader = Test... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/riscv/mod.rs | src/arch/riscv/mod.rs | //! RISCV relocation types
//!
#[cfg(test)]
mod test;
#[derive(Eq, PartialEq, Debug, Clone, Copy)]
#[allow(non_camel_case_types)]
#[repr(u32)]
pub enum RelocationTypes {
/// No relocation.
R_RISCV_NONE,
/// Add 32 bit zero extended symbol value
R_RISCV_32,
/// Add 64 bit symbol value.
... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/arm/mod.rs | src/arch/arm/mod.rs | // Should be in xmas-elf see: https://github.com/nrc/xmas-elf/issues/54
/// Relocation types for ARM 32-bit.
///
/// Based on "ELF for the ARM® Architecture" pdf.
/// Document number: ARM IHI 0044F, current through ABI release 2.10.
/// Date of issue: 24th November 2015.
///
/// The following nomenclature is used for t... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/x86_64/test.rs | src/arch/x86_64/test.rs | use std::fs;
use crate::arch::test::*;
use crate::*;
#[test]
fn load_pie_elf() {
init();
let binary_blob = fs::read("test/test.x86_64").expect("Can't read binary");
let binary = ElfBinary::new(binary_blob.as_slice()).expect("Got proper ELF file");
assert!(binary.is_pie());
let mut loader = TestL... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/x86_64/mod.rs | src/arch/x86_64/mod.rs | #[cfg(test)]
mod test;
// Should be in xmas-elf see: https://github.com/nrc/xmas-elf/issues/54
#[derive(Eq, PartialEq, Debug, Clone, Copy)]
#[allow(non_camel_case_types)]
#[repr(u32)]
pub enum RelocationTypes {
/// No relocation.
R_AMD64_NONE,
/// Add 64 bit symbol value.
R_AMD64_64,
/// PC-relativ... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/aarch64/test.rs | src/arch/aarch64/test.rs | use std::fs;
use crate::arch::test::*;
use crate::*;
#[test]
fn load_pie_elf() {
init();
let binary_blob = fs::read("test/test.aarch64").expect("Can't read binary");
let binary = ElfBinary::new(binary_blob.as_slice()).expect("Got proper ELF file");
assert!(binary.is_pie());
let mut loader = Test... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/aarch64/mod.rs | src/arch/aarch64/mod.rs | //! AArch64 relocation types
//!
//! As defined in the "ELF for the ARM® 64-bit Architecture (AArch64)" doc.
//! Dcoument number: ARM IHI 0056B, current through AArch64 ABI release 1.0
#[cfg(test)]
mod test;
// Should be in xmas-elf see: https://github.com/nrc/xmas-elf/issues/54
#[derive(Eq, PartialEq, Debug, Clone, ... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/x86/test.rs | src/arch/x86/test.rs | use std::fs;
use crate::arch::test::*;
use crate::*;
#[test]
fn load_pie_elf() {
init();
let binary_blob = fs::read("test/test.x86").expect("Can't read binary");
let binary = ElfBinary::new(binary_blob.as_slice()).expect("Got proper ELF file");
assert!(binary.is_pie());
let mut loader = TestLoad... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
gz/rust-elfloader | https://github.com/gz/rust-elfloader/blob/3363aba9a9fefdb1c4edd9f3d992020b532ed890/src/arch/x86/mod.rs | src/arch/x86/mod.rs | #[cfg(test)]
mod test;
// Should be in xmas-elf see: https://github.com/nrc/xmas-elf/issues/54
#[derive(Eq, PartialEq, Debug, Clone, Copy)]
#[allow(non_camel_case_types)]
#[repr(u32)]
pub enum RelocationTypes {
/// No relocation.
R_386_NONE,
/// Add 32 bit dword symbol value.
R_386_32,
/// PC-relat... | rust | Apache-2.0 | 3363aba9a9fefdb1c4edd9f3d992020b532ed890 | 2026-01-04T20:20:38.811615Z | false |
bananaofhappiness/soundscope | https://github.com/bananaofhappiness/soundscope/blob/763740575c4654d9fafd28e77f68771ad3d276b5/src/analyzer.rs | src/analyzer.rs | //! This module is responsible for analyzing audio files.
//! Taking samples it returns the loudness and spectrum.
use ebur128::{EbuR128, Mode};
use eyre::Result;
use spectrum_analyzer::{
FrequencyLimit, samples_fft_to_spectrum, scaling::scale_20_times_log10, windows::hann_window,
};
pub struct Analyzer {
loud... | rust | MIT | 763740575c4654d9fafd28e77f68771ad3d276b5 | 2026-01-04T20:17:12.581714Z | false |
bananaofhappiness/soundscope | https://github.com/bananaofhappiness/soundscope/blob/763740575c4654d9fafd28e77f68771ad3d276b5/src/audio_player.rs | src/audio_player.rs | //! This module contains the implementation of the audio player used to play audio files in user's terminal.
//! under the hood it uses `rodio` for playback and `symphonia` for decoding.
use crossbeam::channel::{Receiver, Sender};
use eyre::{Result, eyre};
use rodio::{ChannelCount, OutputStream, OutputStreamBuilder, Si... | rust | MIT | 763740575c4654d9fafd28e77f68771ad3d276b5 | 2026-01-04T20:17:12.581714Z | false |
bananaofhappiness/soundscope | https://github.com/bananaofhappiness/soundscope/blob/763740575c4654d9fafd28e77f68771ad3d276b5/src/main.rs | src/main.rs | mod analyzer;
mod audio_capture;
mod audio_player;
mod tui;
use crate::audio_player::{AudioFile, AudioPlayer, PlaybackPosition, PlayerCommand};
use crossbeam::channel::{bounded, unbounded};
use eyre::Result;
use ringbuffer::{AllocRingBuffer, RingBuffer};
use std::{
sync::{Arc, Mutex},
thread,
};
fn main() -> R... | rust | MIT | 763740575c4654d9fafd28e77f68771ad3d276b5 | 2026-01-04T20:17:12.581714Z | false |
bananaofhappiness/soundscope | https://github.com/bananaofhappiness/soundscope/blob/763740575c4654d9fafd28e77f68771ad3d276b5/src/tui.rs | src/tui.rs | //! This module contains the implementation of the terminal user interface (TUI) used to display audio analysis results.
//! It uses `ratatui` under the hood.
use crate::{
analyzer::Analyzer,
audio_capture::{self, AudioDevice, list_input_devs},
audio_player::{self, AudioFile, PlayerCommand},
};
use cpal::{S... | rust | MIT | 763740575c4654d9fafd28e77f68771ad3d276b5 | 2026-01-04T20:17:12.581714Z | true |
bananaofhappiness/soundscope | https://github.com/bananaofhappiness/soundscope/blob/763740575c4654d9fafd28e77f68771ad3d276b5/src/audio_capture.rs | src/audio_capture.rs | //! This module is responsible for capturing audio from the PC and microphone.
use crate::tui::RBuffer;
use cpal::{
Device, Stream, StreamConfig, default_host,
traits::{DeviceTrait, HostTrait},
};
use eyre::Result;
pub struct AudioDevice {
device: Device,
config: StreamConfig,
}
impl AudioDevice {
... | rust | MIT | 763740575c4654d9fafd28e77f68771ad3d276b5 | 2026-01-04T20:17:12.581714Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/build.rs | rs/build.rs | fn main() {
embuild::espidf::sysenv::output();
}
| rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/src/critical_section.rs | rs/src/critical_section.rs | //! Critical section implementation for ESP-IDF
//!
//! This module provides a critical section implementation that uses `IsrCriticalSection`, which prevents any interrupt
//! from happening while the critical section is acquired.
//!
//! This is necessary, because the hx711 reading must happen with precise timing, and... | rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/src/ble.rs | rs/src/ble.rs | //! Bluetooth Low Energy (BLE) server implementation
//!
//! This module provides the BLE server implementation for the coffee scale. It exposes a weight characteristic and a
//! battery characteristic.
use std::sync::{Arc, OnceLock};
use anyhow::{anyhow, Result};
use esp32_nimble::{
utilities::{mutex::Mutex, BleU... | rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/src/weight.rs | rs/src/weight.rs | //! Weight sensor module
//!
//! This module contains the code for the weight sensor. It uses the HX711 library to interface with the loadcell and
//! a Kalman filter to smooth out the readings.
//!
//! Ideally, this module would also use interrupts to detect when the HX711 is ready to read, but the current version
//!... | rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/src/main.rs | rs/src/main.rs | //! Firmware for the ESP32 based smart scale.
//!
//! The scale uses a HX711 loadcell amplifier to read the weight and a SSD1306 OLED display to show the weight and
//! battery level.
//!
//! The scale is also a Bluetooth Low Energy (BLE) peripheral that exposes a weight characteristic and a battery
//! characteristic.... | rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/src/battery.rs | rs/src/battery.rs | //! Battery voltage reader
//!
//! This module provides a way to read the battery voltage using the ADC peripheral.
use anyhow::Result;
use esp_idf_svc::hal::{
adc::{self, Adc},
gpio::ADCPin,
peripheral::Peripheral,
};
/// Battery voltage reader
pub struct BatteryReader<'a, ADC: Adc + 'a, PIN: Peripheral<P... | rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
beeb/coffee-scale-app | https://github.com/beeb/coffee-scale-app/blob/1486b8bac6ea97718546fc82ddba372ae85b21af/rs/src/screen.rs | rs/src/screen.rs | //! Display driver for the SSD1306 OLED display.
//!
//! The display is used to show the weight and battery level. It also shows the raw loadcell readings and the ADC value
//! of the battery voltage when in calibration mode.
//!
//! The display is driven by the `ssd1306` crate, which provides a high-level API for the ... | rust | MIT | 1486b8bac6ea97718546fc82ddba372ae85b21af | 2026-01-04T20:20:37.981145Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ffi_interface/src/lib.rs | ffi_interface/src/lib.rs | pub mod serialization;
// TODO: These are re-exported to not break the java code
// TODO: we ideally don't want to export these.
// - deserialize_update_commitment_sparse should not be exported and is an abstraction leak
pub use serialization::{
deserialize_commitment, deserialize_update_commitment_sparse, seriali... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ffi_interface/src/serialization.rs | ffi_interface/src/serialization.rs | use banderwagon::{CanonicalDeserialize, CanonicalSerialize};
use banderwagon::{Element, Fr};
use ipa_multipoint::{
lagrange_basis::LagrangeBasis,
multiproof::{ProverQuery, VerifierQuery},
};
use crate::{CommitmentBytes, Error, ScalarBytes};
// TODO: Find a better name for this
pub type DeserializedSparseCommi... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-db/src/lib.rs | verkle-db/src/lib.rs | ///The traits in this file do not need to be implemented
/// If these methods are implemented, then it allows one to
/// use the default higher level trait implementations
/// that the verkle trie needs. (See database.rs)
#[cfg(feature = "sled_db")]
mod sled_impl;
#[cfg(feature = "sled_db")]
pub use sled_impl::DB as Sl... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-db/src/rocksdb_impl.rs | verkle-db/src/rocksdb_impl.rs | use crate::{BareMetalDiskDb, BareMetalKVDb};
pub use rocksdb::DB;
impl BareMetalDiskDb for DB {
fn from_path<P: AsRef<std::path::Path>>(path: P) -> Self {
// use rusty_leveldb::{CompressionType, Options};
// let mut opt = Options::default();
// opt.compression_type = CompressionType::Compre... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-db/src/sled_impl.rs | verkle-db/src/sled_impl.rs | use crate::{BareMetalDiskDb, BareMetalKVDb};
pub use sled::Db as DB;
impl BareMetalDiskDb for sled::Db {
fn from_path<P: AsRef<std::path::Path>>(path: P) -> Self {
let _config = sled::Config::default().path(path);
_config.open().unwrap()
}
const DEFAULT_PATH: &'static str = "./db/verkle_db... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/element.rs | banderwagon/src/element.rs | use ark_ec::{twisted_edwards::TECurveConfig, Group, ScalarMul, VariableBaseMSM};
use ark_ed_on_bls12_381_bandersnatch::{BandersnatchConfig, EdwardsAffine, EdwardsProjective, Fq};
use ark_ff::{batch_inversion, Field, One, Zero};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
pub use ark_ed_on_bls12_381_... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/lib.rs | banderwagon/src/lib.rs | pub mod msm;
pub mod msm_windowed_sign;
pub mod trait_impls;
mod element;
use ark_ed_on_bls12_381_bandersnatch::Fq;
use ark_ff::BigInteger256;
pub use element::{multi_scalar_mul, Element, Fr};
// Re-export arkworks traits that one may need to use in order to use
// specific methods on field elements and for serializa... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/msm.rs | banderwagon/src/msm.rs | use ark_ec::scalar_mul::wnaf::WnafContext;
use ark_ed_on_bls12_381_bandersnatch::{EdwardsProjective, Fr};
use ark_ff::Zero;
use rayon::prelude::*;
use crate::Element;
#[derive(Clone, Debug)]
pub struct MSMPrecompWnaf {
window_size: usize,
tables: Vec<Vec<EdwardsProjective>>,
}
impl MSMPrecompWnaf {
pub fn... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/trait_impls.rs | banderwagon/src/trait_impls.rs | pub mod from_to_bytes;
pub mod ops;
pub mod serialize;
| rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/msm_windowed_sign.rs | banderwagon/src/msm_windowed_sign.rs | use crate::Element;
use ark_ec::CurveGroup;
use ark_ed_on_bls12_381_bandersnatch::{EdwardsAffine, EdwardsProjective, Fr};
use ark_ff::Zero;
use ark_ff::{BigInteger, BigInteger256};
use std::ops::Neg;
#[derive(Debug, Clone)]
pub struct MSMPrecompWindowSigned {
tables: Vec<Vec<EdwardsAffine>>,
num_windows: usize... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/trait_impls/serialize.rs | banderwagon/src/trait_impls/serialize.rs | use crate::Element;
use ark_ec::CurveGroup;
use ark_ed_on_bls12_381_bandersnatch::EdwardsProjective;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError, Valid};
impl CanonicalSerialize for Element {
fn serialize_with_mode<W: std::io::prelude::Write>(
&self,
mut writer: ... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/trait_impls/from_to_bytes.rs | banderwagon/src/trait_impls/from_to_bytes.rs | use ark_serialize::SerializationError;
pub trait ToBytes<T> {
fn to_bytes(&self) -> Result<T, SerializationError>;
}
pub trait FromBytes<T> {
fn from_bytes(bytes: T) -> Result<Self, SerializationError>
where
Self: Sized;
}
| rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/src/trait_impls/ops.rs | banderwagon/src/trait_impls/ops.rs | use crate::Element;
use ark_ed_on_bls12_381_bandersnatch::Fr;
use std::{
hash::Hash,
iter::Sum,
ops::{Add, AddAssign, Mul, Neg, Sub},
};
impl Mul<Fr> for Element {
type Output = Element;
fn mul(self, rhs: Fr) -> Self::Output {
Element(self.0.mul(rhs))
}
}
impl Mul<&Fr> for &Element {
... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/banderwagon/benches/benchmark.rs | banderwagon/benches/benchmark.rs | use banderwagon::{msm::MSMPrecompWnaf, msm_windowed_sign::MSMPrecompWindowSigned, Element, Fr};
use criterion::{criterion_group, criterion_main, Criterion};
use rand::RngCore;
pub fn msm_wnaf(c: &mut Criterion) {
const NUM_ELEMENTS: usize = 5;
let bases = random_point(120, NUM_ELEMENTS);
let scalars = ran... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/java/rust_code/build.rs | bindings/java/rust_code/build.rs | use std::{env, path::PathBuf};
/// Path to the java directory that we will use to generate the java bindings from
///
/// Relative to the bindings folder.
const PATH_TO_JAVA_BINDINGS_FILE: &str = "java/java_code/src/main/java/verkle/cryptography";
// These are the files needed to pass to the `javac` command to genera... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/java/rust_code/src/lib.rs | bindings/java/rust_code/src/lib.rs | /* Copyright Besu Contributors
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, ... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/java/rust_code/src/utils.rs | bindings/java/rust_code/src/utils.rs | use banderwagon::{CanonicalDeserialize, Element, Fr};
use jni::objects::{JByteArray, JObjectArray};
use jni::JNIEnv;
use std::collections::BTreeSet;
use verkle_trie::proof::ExtPresent;
/// Converts a 32-byte array into an `Element` object.
///
/// This function attempts to convert a fixed-size byte array into an `Elem... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/java/rust_code/src/parsers.rs | bindings/java/rust_code/src/parsers.rs | use ffi_interface::CommitmentBytes;
use jni::{objects::JByteArray, JNIEnv};
use std::convert::TryFrom;
pub fn parse_scalars<'a>(env: &'a JNIEnv<'a>, values: JByteArray<'a>) -> Result<Vec<u8>, String> {
let input_elements = env
.convert_byte_array(values)
.map_err(|_| "cannot convert byte array to v... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/c/build.rs | bindings/c/build.rs | use std::env;
use std::path::PathBuf;
/// The directory where the generated header file will be written.
const DIR_FOR_HEADER: &str = "build";
fn main() {
// linker flags
// Link libm on Unix-like systems (needed due to use of num_cpus crate)
#[cfg(not(target_os = "windows"))]
println!("cargo:rustc-li... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/c/src/lib.rs | bindings/c/src/lib.rs | use ffi_interface::{
deserialize_proof_query, deserialize_proof_query_uncompressed, deserialize_verifier_query,
deserialize_verifier_query_uncompressed, fr_from_le_bytes, Context,
};
use ipa_multipoint::committer::Committer;
use ipa_multipoint::multiproof::{MultiPoint, MultiPointProof, ProverQuery, VerifierQuer... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/csharp/rust_code/build.rs | bindings/csharp/rust_code/build.rs | use std::{env, fs, path::PathBuf};
use toml::Value;
/// The path where the generated bindings file will be written, relative to the bindings folder.
const PATH_FOR_CSHARP_BINDINGS_FILE: &str =
"csharp/csharp_code/Verkle.Bindings/native_methods.g.cs";
fn main() {
let package_name_of_c_crate = get_package_name... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/bindings/csharp/rust_code/src/lib.rs | bindings/csharp/rust_code/src/lib.rs | // This is a dummy crate being used to generate the csharp bindings file with build.rs
| rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/multiproof.rs | ipa-multipoint/src/multiproof.rs | // We get given multiple polynomials evaluated at different points
#![allow(non_snake_case)]
use crate::crs::CRS;
use crate::ipa::{slow_vartime_multiscalar_mul, IPAProof};
use crate::lagrange_basis::{LagrangeBasis, PrecomputedWeights};
use crate::math_utils::powers_of;
use crate::transcript::Transcript;
use crate::tr... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/ipa.rs | ipa-multipoint/src/ipa.rs | #![allow(non_snake_case)]
use crate::crs::CRS;
use crate::math_utils::inner_product;
use crate::transcript::{Transcript, TranscriptProtocol};
use banderwagon::{multi_scalar_mul, trait_defs::*, Element, Fr};
use itertools::Itertools;
use crate::{IOError, IOErrorKind, IOResult};
use std::iter;
#[derive(Debug, Clone, ... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/lib.rs | ipa-multipoint/src/lib.rs | pub mod committer;
pub mod crs;
mod default_crs;
pub mod ipa; // follows the BCMS20 scheme
pub mod math_utils;
pub mod multiproof;
pub mod transcript;
pub mod lagrange_basis;
// TODO: We use the IO Result while we do not have a dedicated Error enum
pub(crate) type IOResult<T> = std::io::Result<T>;
pub(crate) type IOE... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/committer.rs | ipa-multipoint/src/committer.rs | use banderwagon::{msm::MSMPrecompWnaf, msm_windowed_sign::MSMPrecompWindowSigned, Element, Fr};
// This is the functionality that commits to the branch nodes and computes the delta optimization
// For consistency with the Pcs, ensure that this component uses the same CRS as the Pcs
// This is being done in the config ... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/math_utils.rs | ipa-multipoint/src/math_utils.rs | use banderwagon::{trait_defs::*, Fr};
/// Computes the inner product between two scalar vectors
pub fn inner_product(a: &[Fr], b: &[Fr]) -> Fr {
a.iter().zip(b.iter()).map(|(a, b)| *a * *b).sum()
}
pub fn powers_of(point: Fr, n: usize) -> Vec<Fr> {
let mut powers = Vec::with_capacity(n);
powers.push(Fr::on... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/default_crs.rs | ipa-multipoint/src/default_crs.rs | pub(crate) const HEX_ENCODED_CRS : [&str; 257] = [
"a098a29045f1482ea82bdd90b424b82389eb282aec502591eb756633d17a580183c43f2f4eea67cfd9ef71de006ece8c0f31fc4891ba0b74f62c20ac82045c4c",
"823b32fd59b50770b96fe0b20a30f33681c3bf14a92f38ffdf3e72f07d606e6ce52ddfe24377616727e8c738e04e93fecac6ee340246d9a8fdb06619eafbc66b... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | true |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/crs.rs | ipa-multipoint/src/crs.rs | use crate::{default_crs, ipa::slow_vartime_multiscalar_mul, lagrange_basis::LagrangeBasis};
use banderwagon::{try_reduce_to_element, Element};
#[allow(non_snake_case)]
#[derive(Debug, Clone)]
pub struct CRS {
pub n: usize,
pub G: Vec<Element>,
pub Q: Element,
}
impl Default for CRS {
fn default() -> S... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/main.rs | ipa-multipoint/src/main.rs | use banderwagon::{trait_defs::*, Fr};
use ipa_multipoint::committer::{Committer, DefaultCommitter};
use ipa_multipoint::crs::CRS;
use std::time::Instant;
#[allow(clippy::needless_range_loop)]
fn main() {
println!("Benchmarking Pedersen hashing...");
const N: usize = 5000;
let crs = CRS::new(256, "eth_verk... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/lagrange_basis.rs | ipa-multipoint/src/lagrange_basis.rs | use banderwagon::{trait_defs::*, Fr};
use std::ops::{Add, Mul, Sub};
#[derive(Clone, Debug)]
pub struct LagrangeBasis {
// We assume that the domain starts at zero,
// so we only need to supply the upperbound
domain: usize,
values: Vec<Fr>,
}
impl Add<LagrangeBasis> for LagrangeBasis {
type Outpu... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/src/transcript.rs | ipa-multipoint/src/transcript.rs | use banderwagon::{trait_defs::*, Element, Fr};
pub trait TranscriptProtocol {
/// Compute a `label`ed challenge variable.
fn challenge_scalar(&mut self, label: &'static [u8]) -> Fr;
fn append_point(&mut self, label: &'static [u8], point: &Element);
fn append_scalar(&mut self, label: &'static [u8], point... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/benches/benchmark_main.rs | ipa-multipoint/benches/benchmark_main.rs | use criterion::criterion_main;
mod benchmarks;
criterion_main! {
benchmarks::ipa_prove::benches,
benchmarks::ipa_verify::benches,
benchmarks::multipoint_verify::benches,
benchmarks::multipoint_prove::benches,
}
| rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/benches/benchmarks/multipoint_verify.rs | ipa-multipoint/benches/benchmarks/multipoint_verify.rs | use ark_std::UniformRand;
use banderwagon::Fr;
use criterion::BenchmarkId;
use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion};
use ipa_multipoint::crs::CRS;
use ipa_multipoint::lagrange_basis::*;
use ipa_multipoint::multiproof::*;
use ipa_multipoint::transcript::Transcript;
pub fn criter... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/benches/benchmarks/mod.rs | ipa-multipoint/benches/benchmarks/mod.rs | pub mod ipa_prove;
pub mod ipa_verify;
pub mod multipoint_prove;
pub mod multipoint_verify;
| rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/benches/benchmarks/ipa_verify.rs | ipa-multipoint/benches/benchmarks/ipa_verify.rs | use ark_std::rand::SeedableRng;
use ark_std::UniformRand;
use banderwagon::Fr;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ipa_multipoint::crs::CRS;
use ipa_multipoint::ipa::create;
use ipa_multipoint::lagrange_basis::LagrangeBasis;
use ipa_multipoint::math_utils::{inner_product, powers_... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/benches/benchmarks/ipa_prove.rs | ipa-multipoint/benches/benchmarks/ipa_prove.rs | use ark_std::rand::SeedableRng;
use ark_std::UniformRand;
use banderwagon::Fr;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ipa_multipoint::crs::CRS;
use ipa_multipoint::ipa::create;
use ipa_multipoint::lagrange_basis::LagrangeBasis;
use ipa_multipoint::math_utils::powers_of;
use ipa_mult... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/ipa-multipoint/benches/benchmarks/multipoint_prove.rs | ipa-multipoint/benches/benchmarks/multipoint_prove.rs | use ark_std::UniformRand;
use banderwagon::Fr;
use criterion::BenchmarkId;
use criterion::{black_box, criterion_group, criterion_main, BatchSize, Criterion};
use ipa_multipoint::crs::CRS;
use ipa_multipoint::lagrange_basis::*;
use ipa_multipoint::multiproof::*;
use ipa_multipoint::transcript::Transcript;
pub fn criter... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/config.rs | verkle-trie/src/config.rs | use crate::constants::new_crs;
use ipa_multipoint::committer::DefaultCommitter;
// TODO: We may not need to have this be generic, now that we have gotten rid of
// TODO the config with precomputed points
/// Generic configuration file to initialize a verkle trie struct
#[derive(Debug, Clone)]
pub struct Config<Storag... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/errors.rs | verkle-trie/src/errors.rs | use banderwagon::trait_defs::*;
use thiserror::Error;
// Right now there are lots of unwraps which are immediately switched to Results, but in the future
// We likely be moved back to unwraps with safety comments
#[derive(Debug, Error)]
pub enum HintError {
#[error("General IO Error")]
IoError(#[from] std::io... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/proof.rs | verkle-trie/src/proof.rs | use crate::{
constants::{CRS, PRECOMPUTED_WEIGHTS},
errors::HintError,
};
use banderwagon::Element;
use ipa_multipoint::multiproof::MultiPointProof;
use ipa_multipoint::transcript::Transcript;
use std::collections::{BTreeMap, BTreeSet};
use std::io::{Read, Write};
pub mod golang_proof_format;
mod key_path_fin... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/lib.rs | verkle-trie/src/lib.rs | #[deny(unreachable_patterns)]
// pub mod committer;
pub mod config;
pub mod constants;
pub mod database;
pub mod errors;
pub mod from_to_bytes;
pub mod proof;
pub mod trie;
pub use config::*;
use errors::ProofCreationError;
pub use trie::Trie;
pub use banderwagon::{Element, Fr};
pub type Key = [u8; 32];
pub type Val... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/database.rs | verkle-trie/src/database.rs | pub mod default;
mod generic;
pub mod memory_db;
pub mod meta;
pub use default::VerkleDb;
pub use meta::{BranchChild, BranchMeta, Meta, StemMeta};
pub trait ReadWriteHigherDb: ReadOnlyHigherDb + WriteOnlyHigherDb {}
impl<T: ReadOnlyHigherDb + WriteOnlyHigherDb> ReadWriteHigherDb for T {}
// There are two ways to use y... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/from_to_bytes.rs | verkle-trie/src/from_to_bytes.rs | use banderwagon::trait_defs::*;
pub trait ToBytes<T> {
fn to_bytes(&self) -> Result<T, SerializationError>;
}
pub trait FromBytes<T> {
fn from_bytes(bytes: T) -> Result<Self, SerializationError>
where
Self: Sized;
}
| rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/constants.rs | verkle-trie/src/constants.rs | use banderwagon::fr_from_u64_limbs;
pub use banderwagon::Fr;
use ipa_multipoint::{crs::CRS, lagrange_basis::PrecomputedWeights};
use once_cell::sync::Lazy;
pub const FLUSH_BATCH: u32 = 20_000;
// This library only works for a width of 256. It can be modified to work for other widths, but this is
// out of scope for th... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/trie.rs | verkle-trie/src/trie.rs | #![allow(clippy::large_enum_variant)]
use crate::constants::{CRS, TWO_POW_128};
use crate::database::{BranchMeta, Flush, Meta, ReadWriteHigherDb, StemMeta};
use crate::Config;
use crate::{group_to_field, TrieTrait};
use ipa_multipoint::committer::Committer;
use banderwagon::{trait_defs::*, Element, Fr};
#[derive(Debu... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | true |
crate-crypto/rust-verkle | https://github.com/crate-crypto/rust-verkle/blob/e27b8b4edf1992b4afa636c2fc7983bcc27ddb88/verkle-trie/src/proof/opening_data.rs | verkle-trie/src/proof/opening_data.rs | #![allow(clippy::large_enum_variant)]
use super::ExtPresent;
use crate::{
constants::TWO_POW_128,
database::{Meta, ReadOnlyHigherDb},
proof::key_path_finder::{KeyNotFound, KeyPathFinder, KeyState},
};
use banderwagon::{trait_defs::*, Fr};
use ipa_multipoint::{lagrange_basis::LagrangeBasis, multiproof::Prov... | rust | Apache-2.0 | e27b8b4edf1992b4afa636c2fc7983bcc27ddb88 | 2026-01-04T20:20:39.506404Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.