scramble_80211   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/80211.xtm

Implementation

(bind-func scramble_80211
  (let ((pop 1) (push 8))
    (lambda (input output)
      (let ((shift:|7,i64|* (alloc)))
        (afill! shift 1 1 0 1 1 0 0)
        (lambda ()
          (let ((out 0) (j 0)
                (in:i64 (qbuf_pop input)))
            (dotimes (j 8)
              (set! out (^ (>> (& in (<< 1 j)) j)
                           (^ (aref shift 3) (aref shift 6))))
              (aset! shift 6 (aref shift 5))
              (aset! shift 5 (aref shift 4))
              (aset! shift 4 (aref shift 3))
              (aset! shift 3 (aref shift 2))
              (aset! shift 2 (aref shift 1))
              (aset! shift 1 (aref shift 0))
              (aset! shift 0 out)
              (qbuf_push output out)))
          void)))))


Back to Index

Similar Entries