interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / om / sha256 / om2-evidence / s4 / measure / digest.c

14 lines · 645 bytes Raw Blame History
1#include <stdio.h>
2#include <string.h>
3#include <stdint.h>
4#include "sha256.h"
5int main(void){
6 static uint8_t buf[1<<20]; for(size_t i=0;i<sizeof buf;i++) buf[i]=(uint8_t)(i*31u+7u);
7 size_t ns[]={0,3,64,1024,1048576};
8 for(unsigned k=0;k<5;k++){ uint8_t d[SHA256_DIGEST_SIZE]; (void)sha256_hash(buf,ns[k],d);
9 printf("%zu ",ns[k]); for(int i=0;i<32;i++) printf("%02x",d[i]); printf("\n"); }
10 sha256_ctx c; uint8_t d[SHA256_DIGEST_SIZE]; sha256_init(&c);
11 for(size_t o=0;o<1048576;o+=4096) sha256_update(&c,buf+o,4096);
12 sha256_final(&c,d); printf("stream4096 "); for(int i=0;i<32;i++) printf("%02x",d[i]); printf("\n");
13 return 0;
14}