Skip to content

Instantly share code, notes, and snippets.

View iskyd's full-sized avatar

Mattia Careddu iskyd

View GitHub Profile
@iskyd
iskyd / main.rs
Created April 6, 2025 14:10
Ecdsa signature rust
use hex;
use secp256k1::{ecdsa::Signature, Message, Secp256k1, SecretKey};
fn main() {
let msg = hex::decode(String::from(
"e9733bc60ea13c95c6527066bb975a2ff29a925e80aa14c213f686cbae5d2f36",
))
.unwrap();
let secp = Secp256k1::new();
@iskyd
iskyd / main.zig
Created April 6, 2025 14:10
Ecdsa signature Zig
const std = @import("std");
const ecdsa = std.crypto.sign.ecdsa;
fn hexToBytes(comptime size: usize, hex_str: []const u8) ![size]u8 {
var bytes: [size]u8 = undefined;
_ = try std.fmt.hexToBytes(&bytes, hex_str);
return bytes;
}
fn bytesToHex(comptime size: usize, bytes: []const u8) ![size]u8 {
@iskyd
iskyd / txsign.rb
Created November 8, 2024 13:04
tx signature
require "digest" # for hashing transaction data so we can sign it
require "securerandom" # for generating random nonces when signing
# -------------------------
# Elliptic Curve Parameters
# -------------------------
# y² = x³ + ax + b
$a = 0
$b = 7
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@iskyd
iskyd / cifar10.jl
Created March 16, 2023 09:02
Flux Cifar-10
begin
using Flux, MLDatasets, Statistics
using Flux: onehotbatch, onecold, logitcrossentropy, params
using Base.Iterators: partition
using Printf, BSON
using CUDA
using ImageShow
using Images
CUDA.allowscalar(true)
end