MarpaX-Hoonlint

 view release on metacpan or  search on metacpan

hoons/arvo/lib/tester.hoon  view on Meta::CPAN

  ?>  (~(nest ut p:!>(*tang)) & p.call)
  ::
  :-  arm
  :-  %&
  |=  eny=@uvJ  ^-  tang
  ((hard tang) .*(q.v(+6 (init-test eny)) q.call))
::
:>  #  %per-test
:>    data initialized on a per-test basis.
::
++  init-test  |=({eny/@uvJ} %*(. tester eny eny, check-iterations 10))
::
++  tester
  |_  $:  eny=@uvJ                                    :<  entropy
          check-iterations=@u                         :<  # of check trials
          current-iteration=@u                        :<  current iteration
      ==
  :>  #
  :>  #  %check
  :>  #
  :>    gates for quick check style tests.
  +|
  +-  check
    |*  [generator=$-(@uvJ *) test=$-(* ?)]
    |-  ^-  tang
    ?:  (gth current-iteration check-iterations)
      ~
    ::  todo: wrap generator in mule so it can crash.
    =+  sample=(generator eny)
    ::  todo: wrap test in mule so it can crash.
    ?:  (test sample)
      %=  $
        eny    (shaf %huh eny)                        ::  xxx: better random?
        current-iteration  (add current-iteration 1)
      ==
    =/  case  +(current-iteration)

hoons/arvo/sys/zuse.hoon  view on Meta::CPAN

      |=  {p/@ s/@ c/@ d/@}
      (pbl p (met 3 p) s (met 3 s) c d)
    ::                                                  ::  ++pbl:scr:crypto
    ++  pbl                                             ::  w+length
      ~/  %pbl
      |=  {p/@ pl/@ s/@ sl/@ c/@ d/@}
      =>  .(p (end 3 pl p), s (end 3 sl s))
      =+  h=32
      ::
      ::  max key length 1GB
      ::  max iterations 2^28
      ::
      ?>  ?&  (lte d (bex 30))
              (lte c (bex 28))
              !=(c 0)
          ==
      =+  ^=  l  ?~  (mod d h)
          (div d h)
        +((div d h))
      =+  r=(sub d (mul h (dec l)))
      =+  [t=0 j=1 k=1]



( run in 2.230 seconds using v1.01-cache-2.11-cpan-71847e10f99 )