| 1 | .TH surfpcs 3 |
| 2 | .SH NAME |
| 3 | surfpcs \- SURF protected counter sums |
| 4 | .SH SYNTAX |
| 5 | .B #include <surfpcs.h> |
| 6 | |
| 7 | void \fBsurfpcs_init\fP(&\fIs\fR,\fIseed\fR); |
| 8 | |
| 9 | void \fBsurfpcs_add\fP(&\fIs\fR,\fIbuf\fR,\fIlen\fR); |
| 10 | |
| 11 | void \fBsurfpcs_out\fP(&\fIs\fR,\fIh\fR); |
| 12 | |
| 13 | surfpcs \fIs\fR; |
| 14 | .br |
| 15 | uint32 \fIseed\fR[32]; |
| 16 | .br |
| 17 | unsigned char *\fIbuf\fR; |
| 18 | .br |
| 19 | unsigned int \fIlen\fR; |
| 20 | .br |
| 21 | unsigned char \fIh\fR[SURFPCS_LEN]; |
| 22 | .SH DESCRIPTION |
| 23 | .B surfpcs |
| 24 | converts a character string to a 256-bit output, |
| 25 | under control of a 1024-bit seed. |
| 26 | When the seed is secret, |
| 27 | .B surfpcs |
| 28 | appears to be indistinguishable from a completely random |
| 29 | variable-length-to-256-bit function. |
| 30 | |
| 31 | Applying |
| 32 | .B surfpcs |
| 33 | takes three steps. |
| 34 | First, initialize a |
| 35 | .B surfpcs |
| 36 | variable, |
| 37 | .IR s , |
| 38 | with |
| 39 | .BR surfpcs_init . |
| 40 | The seed will be recorded inside |
| 41 | .IR s . |
| 42 | |
| 43 | Second, feed the input to |
| 44 | .BR surfpcs_add . |
| 45 | .I buf |
| 46 | is a pointer to |
| 47 | .I len |
| 48 | characters of input. |
| 49 | You can split the input across any number of |
| 50 | .B surfpcs_add |
| 51 | calls. |
| 52 | |
| 53 | Third, call |
| 54 | .BR surfpcs_out . |
| 55 | The output will be placed into |
| 56 | .IR h , |
| 57 | an array of |
| 58 | .B SURFPCS_LEN |
| 59 | bytes. |
| 60 | .B SURFPCS_LEN |
| 61 | is 32. |
| 62 | |
| 63 | To apply |
| 64 | .B surfpcs |
| 65 | to another input you must call |
| 66 | .B surfpcs_init |
| 67 | again. |
| 68 | .SH "SEE ALSO" |
| 69 | surf(3) |