summaryrefslogtreecommitdiff
path: root/src/librandom/surf_sinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/librandom/surf_sinit.c')
-rw-r--r--src/librandom/surf_sinit.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/librandom/surf_sinit.c b/src/librandom/surf_sinit.c
new file mode 100644
index 0000000..ae7f480
--- /dev/null
+++ b/src/librandom/surf_sinit.c
@@ -0,0 +1,13 @@
+/* ISC license. */
+
+#include <skalibs/uint32.h>
+#include <skalibs/surf.h>
+
+void surf_sinit (SURFSchedule_ref ctx, char const *s)
+{
+ SURFSchedule zero = SURFSCHEDULE_ZERO ;
+ register unsigned int i = 4 ;
+ *ctx = zero ;
+ for (; i < 12 ; i++) uint32_unpack(s + (i<<2) - 16, ctx->in + i) ;
+ for (i = 0 ; i < 32 ; i++) uint32_unpack(s + 32 + (i<<2), ctx->seed + i) ;
+}