oarust 0.9.0

GPU-first semantic computing engine written in Rust
// @generated by tool/gen/fn/generate.py; DO NOT EDIT.
// schema=cryptography_hash.json schema_version=1 generator_version=64
// schema_sha256=982731ed954c1dddbb0b1430f6561e03cbaf7cb6e7880fae9ba317ad9a1fa87b
// No OA C++ fixed SHA-2/SHA-3 batch donor exists (cryptoFnHash.toml).
// Adaptation: schema-owned ABI adapter over existing checked Slang formulas.
// Each invocation owns one whole digest row; all rows contain complete words.
// Input row starts may be unaligned; the imported helpers own packed reads.
import attributes;
import sha2_u32;

struct PushConstants {
	uint input_index;
	uint output_index;
	uint count;
	uint message_len;
};
[[vk::push_constant]] PushConstants push;
[[vk::binding(0, 0)]] RWByteAddressBuffer storage_buffers[];

[kernel_name("sha224")]
[domain("cryptography")]
[variant("generic")]
[dtype("u8")]
[status("experimental")]
[shader("compute")]
[numthreads(32, 1, 1)]
void main(uint3 dispatch_thread_id : SV_DispatchThreadID) {
	uint index = dispatch_thread_id.x;
	if (index >= push.count) return;
	uint input_extent, output_extent;
	storage_buffers[push.input_index].GetDimensions(input_extent);
	storage_buffers[push.output_index].GetDimensions(output_extent);
	// Divide before multiplying, including zero-length messages. Host admission
	// also checks logical byte extents; descriptor extents include word padding.
	if ((input_extent & 3u) != 0u || (output_extent & 3u) != 0u
		|| (push.message_len != 0u && push.count > input_extent / push.message_len)
		|| push.count > output_extent / 28u) return;
	uint digest[7];
	if (!sha2_224(storage_buffers[push.input_index],
		index * push.message_len, push.message_len, digest)) return;
	uint base = index * 28u;
	[loop]
	for (uint word = 0u; word < 7u; ++word) {
		storage_buffers[push.output_index].Store<uint>(base + word * 4u, digest[word]);
	}
}