For montgomery squaring
const SAMPLES: usize = 10000;
for i in 1..(2 * N) {
r[2 * N - i] = (r[2 * N - i] << 1) | (r[2 * N - (i + 1)] >> 63);
}| function [ output_args ] = saveFigure( handle, fileName ) | |
| % saveFigure | |
| % Saves figure specified by `handle` as `fileName` in fullscreen | |
| % as to get around the stupid behavior. | |
| screen_size = get(0, 'ScreenSize'); | |
| origSize = get(handle, 'Position'); % grab original on screen size | |
| set(handle, 'Position', [0 0 screen_size(3) screen_size(4) ] ); %set to scren size | |
| set(handle,'PaperPositionMode','auto') %set paper pos for printing | |
| saveas(handle, fileName) % save figure |
| from web3 import Web3, HTTPProvider, Account | |
| from zksync_sdk import ZkSyncProviderV01, HttpJsonRPCTransport, network, ZkSync, EthereumProvider, Wallet, ZkSyncSigner, EthereumSignerWeb3, ZkSyncLibrary | |
| import asyncio | |
| from zksync_sdk.types import ChainId | |
| from dataclasses import dataclass | |
| @dataclass | |
| class Network: | |
| zksync_url: str |
| # Finding the generators of G1 & G2 of a curve isogenous to BLS12-381, which has non-zero A, B coefficients in Short Weierstrass form. | |
| # Script adapted from https://github.com/zkcrypto/bls12_381/blob/main/src/notes/design.rs | |
| # Below are some links to the IETF draft where the isogeny is defined. | |
| param = -0xd201000000010000 | |
| def r(x): | |
| return (x**4) - (x**2) + 1 | |
| def q(x): | |
| return (((x - 1) ** 2) * ((x**4) - (x**2) + 1) // 3) + x |
| field_modulus = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787 | |
| desired_curve_order = 52435875175126190479447740508185965837690552500527637822603658699938581184513 | |
| x = -0xd201000000010000 | |
| Fp = GF(field_modulus) | |
| Fr = GF(desired_curve_order) | |
| X = Fp(x) | |
| PARAM_A4 = 0 |
| #!/bin/bash | |
| diff=$(cargo fmt -- --check) | |
| result=$? | |
| if [[ ${result} -ne 0 ]] ; then | |
| cat <<\EOF | |
| There are some code style issues, run `cargo fmt` first. | |
| EOF | |
| exit 1 |
| mod miden_note_transport_client { | |
| pub trait NoteTransportClient { | |
| /// Send a serialized, encrypted note to the receiver `AccountId` | |
| fn send_note(&self, note: Note, account_id: AccountId) -> Result<(), Error>; | |
| /// Convenience method that constructs the tag from the account ID and fetches the notes by this tag. | |
| /// Fetches all the notes addressed to a given account, decrypt them and import them into the client | |
| /// Fails if the decryption key associated with `account_id` is missing from client's encryption store. | |
| fn fetch_notes(&self, client: &mut Client, account_id: AccountId) -> Result<Vec<Note>, Error>; | |
| /// Fetch all the notes with a given tag. Allows more customization than `fetch_notes`. | |
| fn fetch_notes_by_tag(&self, client: &mut Client, tag: NoteTag, account_id: AccountId) -> Result<Vec<Note>, Error>; |
| #!/usr/bin/env python3 | |
| """ | |
| Script to convert bare PR numbers in CHANGELOG.md to linkable GitHub PR links. | |
| This script: | |
| - Finds all PR numbers in the format (#1234) or (#1234, #5678, #9012) | |
| - Converts them to linkable GitHub PR links: [#1234](https://github.com/owner/repo/pull/1234) | |
| - Preserves already-linked PR numbers (won't double-link) | |
| - Handles multiple PR numbers per line correctly | |
| - Supports configurable GitHub repository |