VirtualBox

source: vbox/trunk/src/libs/libtpms-0.9.0/tests/base64decode.sh@ 97642

Last change on this file since 97642 was 91612, checked in by vboxsync, 3 years ago

src/libs: Export libtpms-0.9.0, bugref:10078

  • Property svn:executable set to *
File size: 678 bytes
Line 
1#!/usr/bin/env bash
2
3input=$(mktemp)
4binary=$(mktemp)
5
6trap "rm -f $input $binary" EXIT
7
8function sseq()
9{
10 for ((i = $1; i < $2; i=i<<1)); do
11 echo $i
12 done
13}
14
15function do_base64()
16{
17 if [ -n "$(type -p base64)" ]; then
18 base64 $1
19 elif [ -n "$(type -p uuencode)" ]; then
20 uuencode -m $1 data | sed 1d | sed '$d'
21 else
22 echo "No tool found for base64 encoding." >&2
23 exit 1
24 fi
25}
26
27for i in $(sseq 1 1024) 2048 10240;
28do
29 echo $i
30 dd if=/dev/urandom of=$binary bs=1 count=$i &>/dev/null
31 echo "-----BEGIN INITSTATE-----" > $input
32 do_base64 $binary >> $input
33 echo "-----END INITSTATE-----" >> $input
34 ./base64decode $input $binary
35 if [ $? -ne 0 ]; then
36 exit 1
37 fi
38done
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette