5 case $# in 1) ;; *) echo >&2 "usage: $0 DEV"; exit 127 ;; esac
8 typeset
-i sz
; sz
=$
(blockdev
--getsize64
"$dev")
11 ## Figure out a useful block size.
12 typeset
-i bsz
=1 nb
=$sz
16 0) bsz
=$
((bsz
*i
)) nb
=$
((nb
/i
)) ;;
19 if (( bsz
>= 65536 )); then break 2; fi
22 echo >&2 "$0: using $nb blocks of size $bsz"
24 ## Write the initial stream.
25 echo >&2 "$0: writing pseudorandom pattern..."
26 rspit salsa20
/8 -H
$k -z
$sz -pT | \
27 dd status
=none iflag
=fullblock oflag
=direct bs
=$bsz count
=$nb of
="$dev"
28 echo >&2 "$0: writing pseudorandom pattern... done"
30 ## Read the stream back, and check against the reference.
31 echo >&2 "$0: checking pseudorandom pattern..."
32 cmp <(rspit salsa20
/8 -H
$k -z
$sz -pT
) \
33 <(dd status
=none iflag
=direct bs
=$bsz count
=$nb if="$dev")
34 echo >&2 "$0: checking pseudorandom pattern... done"