summaryrefslogtreecommitdiff
path: root/src/librandom/surf_init.c
blob: 49abe51c56a72ccd02bf611610c504775254ff3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <stdint.h>

#include <skalibs/uint32.h>
#include <skalibs/surf.h>

void surf_init (SURFSchedule *ctx, char const *s)
{
  SURFSchedule z = SURFSCHEDULE_ZERO ;
  for (uint32_t i = 4 ; i < 12 ; i++) uint32_unpack(s + (i<<2) - 16, z.in + i) ;
  for (uint32_t i = 0 ; i < 32 ; i++) uint32_unpack(s + 32 + (i<<2), z.seed + i) ;
  *ctx = z ;
}