on c19bc7a help sign in
824 lines 20 kB history raw
1:- :~ navhome/'/docs/'
2 sort/'24'
3 title/'3d: SHA Hash Family'
4 ==
6;>
8# 3d: SHA hash family
10### `++shad`
12Double SHA-256
14Produces an atom that is twice-hashed with `shax`, the SHA-256 cryptographic
15hash algorithm.
17#### Accepts
19`ruz` is an atom.
21#### Produces
23An atom.
25#### Source
27```
28 ++ shad |=(ruz=@ (shax (shax ruz)))
29```
31#### Examples
33```
34 > (shad 11)
35 \/20.519.637.820.582.103.109.435.907.615.585.653.479.776.629.591.855.451.248.\/
36 718.295.626.625.655.417.234
37```
39***
40### `++shaf`
42Half SHA-256
44Produces a 128-bit atom by performing the [bitwise XOR](2d/..) on the
45first and last halves of the 256-bit salted hash `shas`.
47#### Accepts
49`sal` is an atom.
51`ruz` is an atom.
53#### Source
55```
56 ++ shaf :: half sha-256
57 |= [sal=@ ruz=@]
58 =+ haz=(shas sal ruz)
59 (mix (end 7 1 haz) (rsh 7 1 haz))
60```
62#### Examples
64```
65 > (shaf 17 8)
66 52.667.672.807.485.289.251.324.336.639.183.409.041
68 > `@ub`(shaf 17 8)
69 \/0b1011.1111.1101.0110.1110.1000.0100.1110.1100.1000.0010.0100.1111.0001.0010.0010\/
70 .0100.1110.1110.0011.1100.1111.0001.1101.1101.1100.1110.1111.0100.0101.0001.0100
71 \/
72```
74***
75### `++shal`
77SHA-512 with length
79Produces an atom by hashing an atom `ruz` with SHA-512. Another atom, `len`, is
80the byte-length of the theoretical buffer represented by the atom.
82#### Accepts
84`len` is an atom.
86`ruz` is an atom.
88#### Produces
90An atom.
92#### Source
94```
95 ++ shal
96 ~/ %shal
97 |= [len=@ ruz=@] ^- @
98 => .(ruz (cut 3 [0 len] ruz))
99 =+ [few==>(fe .(a 6)) wac=|=([a=@ b/@] (cut 6 [a 1] b))]
100 =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
101 =+ ral=(lsh 0 3 len)
102 =+ ^= ful
103 %+ can 0
104 :~ [ral ruz]
105 [8 128]
106 [(mod (sub 1.920 (mod (add 8 ral) 1.024)) 1.024) 0]
107 [128 (~(net fe 7) ral)]
108 ==
109 =+ lex=(met 10 ful)
110 =+ ^= kbx 0x6c44.198c.4a47.5817.5fcb.6fab.3ad6.faec.
111 597f.299c.fc65.7e2a.4cc5.d4be.cb3e.42b6.
112 431d.67c4.9c10.0d4c.3c9e.be0a.15c9.bebc.
113 32ca.ab7b.40c7.2493.28db.77f5.2304.7d84.
114 1b71.0b35.131c.471b.113f.9804.bef9.0dae.
115 0a63.7dc5.a2c8.98a6.06f0.67aa.7217.6fba.
116 f57d.4f7f.ee6e.d178.eada.7dd6.cde0.eb1e.
117 d186.b8c7.21c0.c207.ca27.3ece.ea26.619c.
118 c671.78f2.e372.532b.bef9.a3f7.b2c6.7915.
119 a450.6ceb.de82.bde9.90be.fffa.2363.1e28.
120 8cc7.0208.1a64.39ec.84c8.7814.a1f0.ab72.
121 78a5.636f.4317.2f60.748f.82ee.5def.b2fc.
122 682e.6ff3.d6b2.b8a3.5b9c.ca4f.7763.e373.
123 4ed8.aa4a.e341.8acb.391c.0cb3.c5c9.5a63.
124 34b0.bcb5.e19b.48a8.2748.774c.df8e.eb99.
125 1e37.6c08.5141.ab53.19a4.c116.b8d2.d0c8.
126 106a.a070.32bb.d1b8.f40e.3585.5771.202a.
127 d699.0624.5565.a910.d192.e819.d6ef.5218.
128 c76c.51a3.0654.be30.c24b.8b70.d0f8.9791.
129 a81a.664b.bc42.3001.a2bf.e8a1.4cf1.0364.
130 9272.2c85.1482.353b.81c2.c92e.47ed.aee6.
131 766a.0abb.3c77.b2a8.650a.7354.8baf.63de.
132 5338.0d13.9d95.b3df.4d2c.6dfc.5ac4.2aed.
133 2e1b.2138.5c26.c926.27b7.0a85.46d2.2ffc.
134 1429.2967.0a0e.6e70.06ca.6351.e003.826f.
135 d5a7.9147.930a.a725.c6e0.0bf3.3da8.8fc2.
136 bf59.7fc7.beef.0ee4.b003.27c8.98fb.213f.
137 a831.c66d.2db4.3210.983e.5152.ee66.dfab.
138 76f9.88da.8311.53b5.5cb0.a9dc.bd41.fbd4.
139 4a74.84aa.6ea6.e483.2de9.2c6f.592b.0275.
140 240c.a1cc.77ac.9c65.0fc1.9dc6.8b8c.d5b5.
141 efbe.4786.384f.25e3.e49b.69c1.9ef1.4ad2.
142 c19b.f174.cf69.2694.9bdc.06a7.25c7.1235.
143 80de.b1fe.3b16.96b1.72be.5d74.f27b.896f.
144 550c.7dc3.d5ff.b4e2.2431.85be.4ee4.b28c.
145 1283.5b01.4570.6fbe.d807.aa98.a303.0242.
146 ab1c.5ed5.da6d.8118.923f.82a4.af19.4f9b.
147 59f1.11f1.b605.d019.3956.c25b.f348.b538.
148 e9b5.dba5.8189.dbbc.b5c0.fbcf.ec4d.3b2f.
149 7137.4491.23ef.65cd.428a.2f98.d728.ae22
150 =+ ^= hax 0x5be0.cd19.137e.2179.1f83.d9ab.fb41.bd6b.
151 9b05.688c.2b3e.6c1f.510e.527f.ade6.82d1.
152 a54f.f53a.5f1d.36f1.3c6e.f372.fe94.f82b.
153 bb67.ae85.84ca.a73b.6a09.e667.f3bc.c908
154 =+ i=0
155 |- ^- @
156 ?: =(i lex)
157 (rep 6 (turn (rip 6 hax) net))
158 =+ ^= wox
159 =+ dux=(cut 10 [i 1] ful)
160 =+ wox=(rep 6 (turn (rip 6 dux) net))
161 =+ j=16
162 |- ^- @
163 ?: =(80 j)
164 wox
165 =+ :* l=(wac (sub j 15) wox)
166 m=(wac (sub j 2) wox)
167 n=(wac (sub j 16) wox)
168 o=(wac (sub j 7) wox)
169 ==
170 =+ x=:(mix (ror 0 1 l) (ror 0 8 l) (rsh 0 7 l))
171 =+ y=:(mix (ror 0 19 m) (ror 0 61 m) (rsh 0 6 m))
172 =+ z=:(sum n x o y)
173 $(wox (con (lsh 6 j z) wox), j +(j))
174 =+ j=0
175 =+ :* a=(wac 0 hax)
176 b=(wac 1 hax)
177 c=(wac 2 hax)
178 d=(wac 3 hax)
179 e=(wac 4 hax)
180 f=(wac 5 hax)
181 g=(wac 6 hax)
182 h=(wac 7 hax)
183 ==
184 |- ^- @
185 ?: =(80 j)
186 %= ^$
187 i +(i)
188 hax %+ rep 6
189 :~ (sum a (wac 0 hax))
190 (sum b (wac 1 hax))
191 (sum c (wac 2 hax))
192 (sum d (wac 3 hax))
193 (sum e (wac 4 hax))
194 (sum f (wac 5 hax))
195 (sum g (wac 6 hax))
196 (sum h (wac 7 hax))
197 ==
198 ==
199 =+ l=:(mix (ror 0 28 a) (ror 0 34 a) (ror 0 39 a)) :: S0
200 =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
201 =+ n=(sum l m) :: t2
202 =+ o=:(mix (ror 0 14 e) (ror 0 18 e) (ror 0 41 e)) :: S1
203 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
204 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
205 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
206```
208#### Examples
210```
211 > (shal 1 'hello')
212 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
213 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
214 847.055.280.028.606.252.747.432.021.213.474
215 \/
217 > (shal 1 'hello')
218 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
219 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
220 847.055.280.028.606.252.747.432.021.213.474
221 \/
222```
224#### Discussion
226Because byte-strings can have leading zeros, but atoms cannot, we use `len`
227as a way of saying that the atom `ruz` is shorter than its representative
228byte-string.
230***
231### `++sham`
233128-bit noun hash
235Produces a 128-bit atom by hashing a noun `yux` with the `shah` function. If
236that noun is a cell, then it is passed to the [`jam`](../2p) function to produce
237an atom to be hashed.
239#### Accepts
241`yux` is a noun.
243#### Produces
245An atom.
247#### Source
249```
250 ++ sham
251 |= yux=* ^- @uvH ^- @
252 ?@ yux
253 (shaf %mash yux)
254 (shaf %sham (jam yux))
255 ::
256```
258#### Examples
260```
261 > (sham [2 4])
262 0v3.71s52.4bqnp.ki2b8.9hhsp.2ufgg
264 > (sham "hello")
265 0v1.hg8mv.t7s3f.u4f8a.q5noe.dvqvh
266```
268***
269### `++shan`
271SHA-1
273Produces an atom by hashing an atom `ruz` with SHA-1.
275#### Accepts
277`ruz` is an atom.
279#### Produces
281An atom.
283#### Source
285```
286 ++ shan
287 |= ruz=@
288 =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
289 =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
290 =+ ral=(lsh 0 3 (met 3 ruz))
291 =+ ^= ful
292 %+ can 0
293 :~ [ral ruz]
294 [8 128]
295 [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
296 [64 (~(net fe 6) ral)]
297 ==
298 =+ lex=(met 9 ful)
299 =+ kbx=0xca62.c1d6.8f1b.bcdc.6ed9.eba1.5a82.7999
300 =+ hax=0xc3d2.e1f0.1032.5476.98ba.dcfe.efcd.ab89.6745.2301
301 =+ i=0
302 |-
303 ?: =(i lex)
304 (rep 5 (flop (rip 5 hax)))
305 =+ ^= wox
306 =+ dux=(cut 9 [i 1] ful)
307 =+ wox=(rep 5 (turn (rip 5 dux) net))
308 =+ j=16
309 |- ^- @
310 ?: =(80 j)
311 wox
312 =+ :* l=(wac (sub j 3) wox)
313 m=(wac (sub j 8) wox)
314 n=(wac (sub j 14) wox)
315 o=(wac (sub j 16) wox)
316 ==
317 =+ z=(rol 0 1 :(mix l m n o))
318 $(wox (con (lsh 5 j z) wox), j +(j))
319 =+ j=0
320 =+ :* a=(wac 0 hax)
321 b=(wac 1 hax)
322 c=(wac 2 hax)
323 d=(wac 3 hax)
324 e=(wac 4 hax)
325 ==
326 |- ^- @
327 ?: =(80 j)
328 %= ^$
329 i +(i)
330 hax %+ rep 5
331 :~
332 (sum a (wac 0 hax))
333 (sum b (wac 1 hax))
334 (sum c (wac 2 hax))
335 (sum d (wac 3 hax))
336 (sum e (wac 4 hax))
337 ==
338 ==
339 =+ fx=(con (dis b c) (dis (not 5 1 b) d))
340 =+ fy=:(mix b c d)
341 =+ fz=:(con (dis b c) (dis b d) (dis c d))
342 =+ ^= tem
343 ?: &((gte j 0) (lte j 19))
344 :(sum (rol 0 5 a) fx e (wac 0 kbx) (wac j wox))
345 ?: &((gte j 20) (lte j 39))
346 :(sum (rol 0 5 a) fy e (wac 1 kbx) (wac j wox))
347 ?: &((gte j 40) (lte j 59))
348 :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
349 :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
350 $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
351```
353#### Examples
355```
356 > (shan 'hello')
357 975.987.071.262.755.080.377.722.350.727.279.193.143.145.743.181
358```
360#### Discussion
362SHA-1 is a deprecated function; it is not considered secure.
364***
365### `++shas`
367Salted hash
369Produces an atom by using SHA-256 plus a salt input. The [bitwise XOR](../2d)
370is performed on `sal` and the product of `ruz` hashed with SHA-256. The product
371of that logical operation is then itself hashed with SHA-256.
373#### Accepts
375`sal` is an atom.
377`ruz` is an atom.
379#### Source
381```
382 ++ shas
383 |= [sal=@ ruz=@]
384 (shax (mix sal (shax ruz)))
385```
387#### Examples
389```
390 > (shas 12.845 6)
391 \/111.115.941.493.032.291.043.932.789.632.248.509.108.945.255.494.251.860.287\/
392 .707.279.709.200.349.471.936
393 \/
394```
396***
397### `++shaw`
399Hash to nbits
401Produces an atom of `len` random bits by hashing `ruz` with the salted
402SHA-256 hash algorithm, where `sal` is the cryptographic salt.
404#### Accepts
406`sal` is an atom.
408`len` is an atom.
410`ruz` is an atom.
412#### Produces
414An atom.
416#### Source
418```
419 ++ shaw
420 |= [sal=@ len=@ ruz=@]
421 (~(raw og (shas sal (mix len ruz))) len)
422```
424#### Examples
426```
427 > `@ub`(shaw 3 6 98)
428 0b11.0111
430 > `@ub`(shaw 2 6 98)
431 0b11
432```
434***
435### `++shax`
437SHA-256
439Produces an atom by hashing an atom `ruz` with SHA-256.
441#### Sources
443```
444 ++ shax
445 ~/ %shax
446 |= ruz=@ ^- @
447 (shay [(met 3 ruz) ruz])
448```
450#### Examples
452```
453 > (shax 'hello')
454 \/16.552.786.619.039.860.277.601.417.878.457.384.195.409.020.923.835.016.617.984.82\/
455 0.774.431.701.725.740
456 \/
457```
459***
460### `++shay`
462SHA-256 with length
464Produces an atom by hashing an atom `ruz` with SHA-512. Another atom, `len`, is
465the byte-length of the theoretical buffer represented by the atom.
467#### Accepts
469`len` is an atom.
471`ruz` is an atom.
473#### Source
475```
476 ++ shay
477 ~/ %shay
478 |= [len=@u ruz=@] ^- @
479 => .(ruz (cut 3 [0 len] ruz))
480 =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
481 =+ [sum=sum.few ror=ror.few net=net.few inv=inv.few]
482 =+ ral=(lsh 0 3 len)
483 =+ ^= ful
484 %+ can 0
485 :~ [ral ruz]
486 [8 128]
487 [(mod (sub 960 (mod (add 8 ral) 512)) 512) 0]
488 [64 (~(net fe 6) ral)]
489 ==
490 =+ lex=(met 9 ful)
491 =+ ^= kbx 0xc671.78f2.bef9.a3f7.a450.6ceb.90be.fffa.
492 8cc7.0208.84c8.7814.78a5.636f.748f.82ee.
493 682e.6ff3.5b9c.ca4f.4ed8.aa4a.391c.0cb3.
494 34b0.bcb5.2748.774c.1e37.6c08.19a4.c116.
495 106a.a070.f40e.3585.d699.0624.d192.e819.
496 c76c.51a3.c24b.8b70.a81a.664b.a2bf.e8a1.
497 9272.2c85.81c2.c92e.766a.0abb.650a.7354.
498 5338.0d13.4d2c.6dfc.2e1b.2138.27b7.0a85.
499 1429.2967.06ca.6351.d5a7.9147.c6e0.0bf3.
500 bf59.7fc7.b003.27c8.a831.c66d.983e.5152.
501 76f9.88da.5cb0.a9dc.4a74.84aa.2de9.2c6f.
502 240c.a1cc.0fc1.9dc6.efbe.4786.e49b.69c1.
503 c19b.f174.9bdc.06a7.80de.b1fe.72be.5d74.
504 550c.7dc3.2431.85be.1283.5b01.d807.aa98.
505 ab1c.5ed5.923f.82a4.59f1.11f1.3956.c25b.
506 e9b5.dba5.b5c0.fbcf.7137.4491.428a.2f98
507 =+ ^= hax 0x5be0.cd19.1f83.d9ab.9b05.688c.510e.527f.
508 a54f.f53a.3c6e.f372.bb67.ae85.6a09.e667
509 =+ i=0
510 |- ^- @
511 ?: =(i lex)
512 (rep 5 (turn (rip 5 hax) net))
513 =+ ^= wox
514 =+ dux=(cut 9 [i 1] ful)
515 =+ wox=(rep 5 (turn (rip 5 dux) net))
516 =+ j=16
517 |- ^- @
518 ?: =(64 j)
519 wox
520 =+ :* l=(wac (sub j 15) wox)
521 m=(wac (sub j 2) wox)
522 n=(wac (sub j 16) wox)
523 o=(wac (sub j 7) wox)
524 ==
525 =+ x=:(mix (ror 0 7 l) (ror 0 18 l) (rsh 0 3 l))
526 =+ y=:(mix (ror 0 17 m) (ror 0 19 m) (rsh 0 10 m))
527 =+ z=:(sum n x o y)
528 $(wox (con (lsh 5 j z) wox), j +(j))
529 =+ j=0
530 =+ :* a=(wac 0 hax)
531 b=(wac 1 hax)
532 c=(wac 2 hax)
533 d=(wac 3 hax)
534 e=(wac 4 hax)
535 f=(wac 5 hax)
536 g=(wac 6 hax)
537 h=(wac 7 hax)
538 ==
539 |- ^- @
540 ?: =(64 j)
541 %= ^$
542 i +(i)
543 hax %+ rep 5
544 :~ (sum a (wac 0 hax))
545 (sum b (wac 1 hax))
546 (sum c (wac 2 hax))
547 (sum d (wac 3 hax))
548 (sum e (wac 4 hax))
549 (sum f (wac 5 hax))
550 (sum g (wac 6 hax))
551 (sum h (wac 7 hax))
552 ==
553 ==
554 =+ l=:(mix (ror 0 2 a) (ror 0 13 a) (ror 0 22 a)) :: s0
555 =+ m=:(mix (dis a b) (dis a c) (dis b c)) :: maj
556 =+ n=(sum l m) :: t2
557 =+ o=:(mix (ror 0 6 e) (ror 0 11 e) (ror 0 25 e)) :: s1
558 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
559 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
560 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
561```
563#### Examples
565```
566 > (shay 1 'hello')
567 \/16.144.219.278.061.159.438.339.586.294.967.166.038.336.988.797.862.808.055.174.98\/
568 7.398.597.302.069.674
569 \/
571 > (shay 2 'hello')
572 \/100.467.333.538.737.303.691.714.735.404.408.035.555.613.179.595.938.688.113.300.8\/
573 01.974.878.934.544.183
574 \/
575```
577#### Discussion
579Because byte-strings can have leading zeros, but atoms cannot, we use `len`
580as a way of saying that the atom `ruz` is shorter than its representative
581byte-string.
583***
584### `++shaz`
586SHA-512
588Produces an atom by hashing an atom `ruz` with SHA-512.
590#### Accepts
592`ruz` is an atom.
594#### Produces
596An atom.
598#### Source
600```
601 ++ shaz
602 |= ruz=@ ^- @
603 (shal [(met 3 ruz) ruz])
604```
606#### Examples
608```
609 > (shaz 'hello')
610 \/3.548.533.422.469.437.734.729.094.584.175.910.682.076.656.883.559.953.324.378.007\/
611 .735.849.386.038.666.450.748.109.671.344.747.196.048.200.348.948.408.339.256.384.
612 360.070.359.656.053.016.948.640.159.265.179
613 \/
614```
616***
617### `++og`
619Container arm for SHA-256-powered random-number generation. Its sample `a` is an
620atom that is used as a seed for the hash.
622#### Accepts
624`a` is an atom.
626#### Produces
628A core.
630#### Source
632```
633 ++ og
634 ~/ %og
635 |_ a=@
636```
638#### Examples
640```
641 > ~(. og 919)
642 <4.wmp {a/@ud <54.tyv 119.olq 31.ohr 1.jmk $143>}>
643```
645#### Discussion
647Note that the product is deterministic; the seed will produce the same
648result every time it is run. Use `eny`, 256 bits of entropy, for a
649non-deterministic product.
651***
652### `++rad`
654Random in range
656Produces a random number that is within the range of first `b` whole numbers,
657starting at `0`.
659#### Accepts
661`b` is an atom.
663#### Produces
665An atom.
667#### Source
669```
670 ++ rad
671 |= b=@ ^- @
672 =+ c=(raw (met 0 b))
673 ?:((lth c b) c $(a +(a)))
674```
676#### Examples
678```
679 > (~(rad og 5) 11)
680 4
682 > (~(rad og 758.716.593) 11)
683 2
685 > (~(rad og 1) 100.000)
686 71.499
688 > (~(rad og eny) 11) :: `eny` acts as a random sample
689 7
690```
692***
693### `++rads`
695Random continuation
697Produces a cell. The head of the cell is a random number that is within the
698range of first `b` whole numbers, starting at `0`. The tail is a new core
699produced from hashing the parent core with `(rad b)`.
701#### Accepts
703`b` is an atom.
705#### Produces
707A cell.
709#### Source
711```
712 ++ rads
713 |= b=@
714 =+ r=(rad b)
715 [r +>.$(a (shas %og-s (mix a r)))]
716```
718#### Examples
720```
721 > (~(rads og 4) 10)
722 [2 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
724 > =/ rng ~(. og 7)
725 =^ a rng (rads:rng 10)
726 =^ b rng (rads:rng 10)
727 [a b]
728 [2 8]
729```
731#### Discussion
733Since everything in Hoon is a pure function, we need to use tricks like this to
734generate separate random values from the same seed. Notice how we jump from
735one `rads` function call to another in the above example.
737***
738### `++raw`
740Random bits
742Produces an atom with a bitwidth `b` that is composed of random bits.
744#### Accepts
746`b` is an atom.
748#### Produces
750An atom.
752#### Source
754```
755 ++ raw
756 ~/ %raw
757 |= b=@ ^- @
758 %+ can
759 0
760 =+ c=(shas %og-a (mix b a))
761 |- ^- (list [@ @])
762 ?: =(0 b)
763 ~
764 =+ d=(shas %og-b (mix b (mix a c)))
765 ?: (lth b 256)
766 [[b (end 0 b d)] ~]
767 [[256 d] $(c d, b (sub b 256))]
768```
770#### Examples
772```
773 > `@ud`(~(raw og 27) 4)
774 0b1001
776 > `@ub`(~(raw og 27) 3)
777 0b0
779 > `@ub`(~(raw og 11) 4)
780 0b1111
782 > `@ub`(~(raw og 11) 3)
783 0b100
784```
786***
787### `++raws`
789Random bits continuation
791Produces a cell. The head of the cell is an atom with a bitwidth `b` that is
792composed of random bits. The tail is a new core produced from hashing the
793parent core with `(raw b)`.
795#### Source
797```
798 ++ raws
799 |= b=@
800 =+ r=(raw b)
801 [r +>.$(a (shas %og-s r))]
802 --
803```
805#### Examples
807```
808 > `[@ub _og]`(~(raws og 7) 4)
809 [0b1100 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
811 > =/ rng ~(. og 7)
812 =^ a rng (rads:rng 4)
813 =^ b rng (rads:rng 4)
814 [`@ub`a `@ub`b]
815 [0b10 0b1]
816```
818#### Discussion
820Since everything in Hoon is a pure function, we need to use tricks like this to
821generate separate random values from the same seed. Notice how we jump from
822one `raws` function call to another in the above example.
824***