tiny.simd.AesCtrEngine
Defined in random.
API (5)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/simd/src/random.zig:250
zig
pub const AesCtrEngine = struct { key: [2 * (1 + rounds)]u64, const rounds: usize = 5; const D: type = tag.Full128(u8); const D64: type = tag.Full128(u64); pub fn initDeterministic() AesCtrEngine { return initKey(.{ 0x243f_6a88_85a3_08d3, 0x1319_8a2e_0370_7344 }); } pub fn initKey(seed: [2]u64) AesCtrEngine { var result: AesCtrEngine = undefined; result.key[0] = seed[0]; result.key[1] = seed[1]; inline for (0..rounds) |index| { result.key[2 + 2 * index] = result.key[2 * index + 1] +% 0xa409_3822_299f_31d0; result.key[2 + 2 * index + 1] = result.key[2 * index] +% 0x082e_fa98_ec4e_6c89; } return result; } pub fn initWithEntropy(entropy: anytype) !AesCtrEngine { var bytes: [16]u8 = undefined; try entropy.fill(&bytes); return initKey(@bitCast(bytes)); } pub fn generate(self: *const AesCtrEngine, stream: u64, counter: u64) u64 { var state: D.Vector = @bitCast(@as(D64.Vector, .{ counter, stream })); state ^= keyVector(self.key[0..2].*); inline for (0..rounds) |index| { state = crypto.aesRound(D, state, keyVector(self.key[2 + 2 * index ..][0..2].*)); } const result: D64.Vector = @bitCast(state); return result[0]; } fn keyVector(pair: [2]u64) D.Vector { return @bitCast(@as(D64.Vector, pair)); }};Source: lib/simd/src/root.zig:511
zig
pub const AesCtrEngine = random.AesCtrEngine;Complete caller list for AesCtrEngine.initDeterministic
29 direct callers.
lib.simd.src.cuckoo.builder.Plan[function] — private source atlib/simd/src/cuckoo/builder.zig:29in nearest public ownerlib.simd.src.cuckoo.builderlib.simd.src.cuckoo.builder.expectDefaultBuild[function] — private source atlib/simd/src/cuckoo/builder.zig:753in nearest public ownerlib.simd.src.cuckoo.builderlib.simd.src.cuckoo.builder.test_Highway_generic_Cuckoo_builder_completes_maximum_matching[function] — test source atlib/simd/src/cuckoo/builder.zig:567in nearest public ownerlib.simd.src.cuckoo.builderlib.simd.src.cuckoo.family.fixtureTable[function] — private source atlib/simd/src/cuckoo/family.zig:472in nearest public ownerlib.simd.src.cuckoo.familylib.simd.src.cuckoo.family.test_Highway_generic_Cuckoo_query_table_oracle_matches_exactly[function] — test source atlib/simd/src/cuckoo/family.zig:548in nearest public ownerlib.simd.src.cuckoo.familylib.simd.src.cuckoo.local.Plan[function] — private source atlib/simd/src/cuckoo/local.zig:7in nearest public ownerlib.simd.src.cuckoo.locallib.simd.src.cuckoo.local.Search[function] — private source atlib/simd/src/cuckoo/local.zig:103in nearest public ownerlib.simd.src.cuckoo.locallib.simd.src.cuckoo.local.test_Highway_Cuckoo_local_search_builds_a_deterministic_complete_table[function] — test source atlib/simd/src/cuckoo/local.zig:240in nearest public ownerlib.simd.src.cuckoo.locallib.simd.src.cuckoo.optimizer.Plan[function] — private source atlib/simd/src/cuckoo/optimizer.zig:7in nearest public ownerlib.simd.src.cuckoo.optimizerlib.simd.src.cuckoo.optimizer.test_Highway_optimized_Cuckoo_builder_completes_minimum-cost_matching[function] — test source atlib/simd/src/cuckoo/optimizer.zig:549in nearest public ownerlib.simd.src.cuckoo.optimizerlib.simd.src.cuckoo.optimizer.test_Highway_optimized_Cuckoo_builder_preserves_deeper_path_costs[function] — test source atlib/simd/src/cuckoo/optimizer.zig:589in nearest public ownerlib.simd.src.cuckoo.optimizertiny.simd.Cuckoo2x2Plan.build[method] atlib/simd/src/cuckoo2x2.zig:170lib.simd.src.hash.test_Highway_AVX2_keyed_hash_oracle_matches_exactly[function] — test source atlib/simd/src/hash.zig:361in nearest public ownertiny.simd.hashlib.simd.src.hash.test_Highway_Triple32_avalanche_and_output_bits_remain_balanced[function] — test source atlib/simd/src/hash.zig:498in nearest public ownertiny.simd.hashlib.simd.src.hash.test_Highway_hash_arrays_preserve_scalar_order_through_full_vectors_and_tails[function] — test source atlib/simd/src/hash.zig:450in nearest public ownertiny.simd.hashlib.simd.src.hash.test_Highway_hash_edge_cases_remain_nontrivial_and_seed_separated[function] — test source atlib/simd/src/hash.zig:474in nearest public ownertiny.simd.hashlib.simd.src.hash.test_Highway_hash_scalar_and_vector_paths_agree_lane_by_lane[function] — test source atlib/simd/src/hash.zig:334in nearest public ownertiny.simd.hashlib.simd.src.hash.test_Highway_masked_hashes_remain_bijections_on_a_small_complete_domain[function] — test source atlib/simd/src/hash.zig:433in nearest public ownertiny.simd.hashlib.simd.src.hash.test_Highway_masked_hashes_retain_their_declared_ranges[function] — test source atlib/simd/src/hash.zig:440in nearest public ownertiny.simd.hashlib.simd.src.phast.builder.Builder.validateDistinct[method] — private source atlib/simd/src/phast/builder.zig:189in nearest public ownerlib.simd.src.phast.buildertiny.simd.PhastBuildPlan.build[method] atlib/simd/src/phast/builder.zig:77lib.simd.src.random.test_Highway_AES_counter_bit_and_byte_distributions_remain_balanced[function] — test source atlib/simd/src/random.zig:558in nearest public ownertiny.simd.randomlib.simd.src.random.test_Highway_AES_counter_streams_are_deterministic_and_independently_addressed[function] — test source atlib/simd/src/random.zig:511in nearest public ownertiny.simd.randomlib.simd.src.random.test_Highway_AVX2_AES_counter_and_normalized_float_oracle_matches_exactly[function] — test source atlib/simd/src/random.zig:523in nearest public ownertiny.simd.randomlib.simd.src.random.test_Highway_normalized_float_spans_the_half-open_signed_unit_interval[function] — test source atlib/simd/src/random.zig:546in nearest public ownertiny.simd.randomtiny.simd.ShardMulPlan.build[method] atlib/simd/src/shardmul.zig:225tiny.simd.ShardMulPlan.inspect[function] atlib/simd/src/shardmul.zig:164lib.simd.src.shardmul.fillClusteredKeys[function] — private source atlib/simd/src/shardmul.zig:570in nearest public ownertiny.simd.shardmullib.simd.src.shardmul.test_Highway_ShardMul_builder_produces_collision-free_outputs_and_excludes_extras[function] — test source atlib/simd/src/shardmul.zig:503in nearest public ownertiny.simd.shardmul
Audit
| Definitions | 5 |
|---|---|
| Public names | 10 |
| Members | 1 |
| Version | 26.7.0 |
| Revision | daab053ee433 |