Skip to content

Instantly share code, notes, and snippets.

@ambiso
ambiso / aead.rs
Created May 2, 2023 18:16
rust ring aead example
use ring::aead;
use ring::aead::BoundKey;
use ring::error::Unspecified;
use ring::rand::SecureRandom;
use ring::rand::SystemRandom;
pub struct NonceGenerator {
last_nonce: u64,
}
@ambiso
ambiso / words.json
Created November 10, 2021 16:32
List of 295 unique 2-character prefixes and words with at least 3 letters and only the letters A-Z that have said prefix
This file has been truncated, but you can view the full file.
{
"nu": [
"nuzzles",
"nubs",
"nutritiousness",
"numerals",
"numerous",
"nutrition",
"nubbiest",
"numeric",
@ambiso
ambiso / even_pairs.cc
Last active January 13, 2018 21:51
Count the number of even sum subarrays in an array
#include <iostream>
#include <vector>
using namespace std;
int even_pairs(const vector<bool> &v) {
int even_now = 0, odd_now = 0;
int total = 0;
for (bool x : v) {
int even_before = even_now;