quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

test_suite_base64.data (14034B)


      1 enc_char (all digits)
      2 enc_chars:
      3 
      4 dec_value (all characters)
      5 dec_chars:
      6 
      7 Test case mbedtls_base64_encode #1 buffer just right
      8 mbedtls_base64_encode:"":"":0:0
      9 
     10 Test case mbedtls_base64_encode #2 buffer just right
     11 mbedtls_base64_encode:"f":"Zg==":5:0
     12 
     13 Test case mbedtls_base64_encode #2 buffer too small
     14 mbedtls_base64_encode:"f":"Zg==":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
     15 
     16 Test case mbedtls_base64_encode #3 buffer just right
     17 mbedtls_base64_encode:"fo":"Zm8=":5:0
     18 
     19 Test case mbedtls_base64_encode #3 buffer too small
     20 mbedtls_base64_encode:"fo":"Zm8=":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
     21 
     22 Test case mbedtls_base64_encode #4 buffer just right
     23 mbedtls_base64_encode:"foo":"Zm9v":5:0
     24 
     25 Test case mbedtls_base64_encode #4 buffer too small
     26 mbedtls_base64_encode:"foo":"Zm9v":4:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
     27 
     28 Test case mbedtls_base64_encode #5 buffer just right
     29 mbedtls_base64_encode:"foob":"Zm9vYg==":9:0
     30 
     31 Test case mbedtls_base64_encode #5 buffer too small
     32 mbedtls_base64_encode:"foob":"Zm9vYg==":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
     33 
     34 Test case mbedtls_base64_encode #6 buffer just right
     35 mbedtls_base64_encode:"fooba":"Zm9vYmE=":9:0
     36 
     37 Test case mbedtls_base64_encode #6 buffer too small
     38 mbedtls_base64_encode:"fooba":"Zm9vYmE=":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
     39 
     40 Test case mbedtls_base64_encode #7 buffer just right
     41 mbedtls_base64_encode:"foobar":"Zm9vYmFy":9:0
     42 
     43 Test case mbedtls_base64_encode #7 buffer too small
     44 mbedtls_base64_encode:"foobar":"Zm9vYmFy":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
     45 
     46 Test case mbedtls_base64_decode #1
     47 mbedtls_base64_decode:"":"":0
     48 
     49 Test case mbedtls_base64_decode #2
     50 mbedtls_base64_decode:"Zg==":"f":0
     51 
     52 Test case mbedtls_base64_decode #3
     53 mbedtls_base64_decode:"Zm8=":"fo":0
     54 
     55 Test case mbedtls_base64_decode #4
     56 mbedtls_base64_decode:"Zm9v":"foo":0
     57 
     58 Test case mbedtls_base64_decode #5
     59 mbedtls_base64_decode:"Zm9vYg==":"foob":0
     60 
     61 Test case mbedtls_base64_decode #6
     62 mbedtls_base64_decode:"Zm9vYmE=":"fooba":0
     63 
     64 Test case mbedtls_base64_decode #7
     65 mbedtls_base64_decode:"Zm9vYmFy":"foobar":0
     66 
     67 Base64 decode (Illegal character)
     68 mbedtls_base64_decode:"zm#=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     69 
     70 Base64 decode (Too much equal signs)
     71 mbedtls_base64_decode:"zm===":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     72 
     73 Base64 decode (Invalid char after equal signs)
     74 mbedtls_base64_decode:"zm=masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     75 
     76 Base64 decode (Space inside string)
     77 mbedtls_base64_decode:"zm masd":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     78 
     79 # The next few test cases validate systematically for short inputs that
     80 # we require the correct number of trailing equal signs.
     81 
     82 # 4k+1 digits is always wrong (wouldn't encode more bytes than 4k digits)
     83 Base64 decode: 1 digit, 0 equals (bad)
     84 mbedtls_base64_decode:"Y":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     85 
     86 Base64 decode: 1 digit, 1 equals (bad)
     87 mbedtls_base64_decode:"Y=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     88 
     89 Base64 decode: 1 digit, 2 equals (bad)
     90 mbedtls_base64_decode:"Y==":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     91 
     92 Base64 decode: 1 digit, 3 equals (bad)
     93 mbedtls_base64_decode:"Y===":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     94 
     95 Base64 decode: 2 digits, 0 equals (bad)
     96 mbedtls_base64_decode:"Yw":"c":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
     97 
     98 Base64 decode: 2 digits, 1 equals (bad)
     99 mbedtls_base64_decode:"Yw=":"c":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    100 
    101 Base64 decode: 2 digits, 2 equals (good)
    102 mbedtls_base64_decode:"Yw==":"c":0
    103 
    104 Base64 decode: 2 digits, 3 equals (bad)
    105 mbedtls_base64_decode:"Yw===":"c":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    106 
    107 Base64 decode: 3 digits, 0 equals (bad)
    108 mbedtls_base64_decode:"Y28":"co":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    109 
    110 Base64 decode: 3 digits, 1 equals (good)
    111 mbedtls_base64_decode:"Y28=":"co":0
    112 
    113 Base64 decode: 3 digits, 2 equals (bad)
    114 mbedtls_base64_decode:"Y28==":"co":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    115 
    116 Base64 decode: 3 digits, 3 equals (bad)
    117 mbedtls_base64_decode:"Y28===":"co":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    118 
    119 Base64 decode: 4 digits, 0 equals (good)
    120 mbedtls_base64_decode:"Y29t":"com":0
    121 
    122 Base64 decode: 4 digits, 1 equals (bad)
    123 mbedtls_base64_decode:"Y29t=":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    124 
    125 Base64 decode: 4 digits, 2 equals (bad)
    126 mbedtls_base64_decode:"Y29t==":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    127 
    128 Base64 decode: 4 digits, 3 equals (bad)
    129 mbedtls_base64_decode:"Y29t===":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    130 
    131 # 4k+1 digits is always wrong (wouldn't encode more bytes than 4k digits)
    132 Base64 decode: 5 digits, 0 equals (bad)
    133 mbedtls_base64_decode:"Y29tc":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    134 
    135 Base64 decode: 5 digits, 1 equals (bad)
    136 mbedtls_base64_decode:"Y29tc=":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    137 
    138 Base64 decode: 5 digits, 2 equals (bad)
    139 mbedtls_base64_decode:"Y29tc==":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    140 
    141 Base64 decode: 5 digits, 3 equals (bad)
    142 mbedtls_base64_decode:"Y29tc===":"com":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    143 
    144 Base64 decode: 6 digits, 0 equals (bad)
    145 mbedtls_base64_decode:"Y29tcA":"comp":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    146 
    147 Base64 decode: 6 digits, 1 equals (bad)
    148 mbedtls_base64_decode:"Y29tcA=":"comp":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    149 
    150 Base64 decode: 6 digits, 2 equals (good)
    151 mbedtls_base64_decode:"Y29tcA==":"comp":0
    152 
    153 Base64 decode: 6 digits, 3 equals (bad)
    154 mbedtls_base64_decode:"Y29tcA===":"comp":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    155 
    156 Base64 decode: 7 digits, 0 equals (bad)
    157 mbedtls_base64_decode:"Y29tcG8":"compo":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    158 
    159 Base64 decode: 7 digits, 1 equals (good)
    160 mbedtls_base64_decode:"Y29tcG8=":"compo":0
    161 
    162 Base64 decode: 7 digits, 2 equals (bad)
    163 mbedtls_base64_decode:"Y29tcG8==":"compo":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    164 
    165 Base64 decode: 7 digits, 3 equals (bad)
    166 mbedtls_base64_decode:"Y29tcG8===":"compo":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    167 
    168 Base64 decode: 8 digits, 0 equals (good)
    169 mbedtls_base64_decode:"Y29tcG9z":"compos":0
    170 
    171 Base64 decode: 8 digits, 1 equals (bad)
    172 mbedtls_base64_decode:"Y29tcG9z=":"compos":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    173 
    174 Base64 decode: 8 digits, 2 equals (bad)
    175 mbedtls_base64_decode:"Y29tcG9z==":"compos":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    176 
    177 Base64 decode: 8 digits, 3 equals (bad)
    178 mbedtls_base64_decode:"Y29tcG9z===":"compos":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    179 
    180 Base64 decode "Zm9vYmFy" (no newline nor '\0' at end)
    181 base64_decode_hex_src:"5a6d3976596d4679":"foobar":0
    182 
    183 Base64 decode "Zm9vYmFy\n" (LF at end)
    184 base64_decode_hex_src:"5a6d3976596d46790a":"foobar":0
    185 
    186 Base64 decode "Zm9vYmFy\r\n" (CRLF at end)
    187 base64_decode_hex_src:"5a6d3976596d46790d0a":"foobar":0
    188 
    189 Base64 decode "Zm9vYmFy\r" (CR at end)
    190 base64_decode_hex_src:"5a6d3976596d46790d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    191 
    192 Base64 decode "Zm9vYmFy " (SP at end)
    193 base64_decode_hex_src:"5a6d3976596d467920":"foobar":0
    194 
    195 Base64 decode "Zm9vYmFy \n" (SP+LF at end)
    196 base64_decode_hex_src:"5a6d3976596d4679200a":"foobar":0
    197 
    198 Base64 decode "Zm9vYmFy \r\n" (SP+CRLF at end)
    199 base64_decode_hex_src:"5a6d3976596d4679200d0a":"foobar":0
    200 
    201 Base64 decode "Zm9vYmFy \r" (SP+CR at end)
    202 base64_decode_hex_src:"5a6d3976596d4679200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    203 
    204 Base64 decode "Zm9vYmFy  " (2SP at end)
    205 base64_decode_hex_src:"5a6d3976596d46792020":"foobar":0
    206 
    207 Base64 decode "Zm9vYmFy  \n" (2SP+LF at end)
    208 base64_decode_hex_src:"5a6d3976596d467920200a":"foobar":0
    209 
    210 Base64 decode "Zm9vYmFy  \r\n" (2SP+CRLF at end)
    211 base64_decode_hex_src:"5a6d3976596d467920200d0a":"foobar":0
    212 
    213 Base64 decode "Zm9vYmFy  \r" (2SP+CR at end)
    214 base64_decode_hex_src:"5a6d3976596d467920200d":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    215 
    216 Base64 decode "Zm9vYmF\ny" (LF inside)
    217 base64_decode_hex_src:"5a6d3976596d460a79":"foobar":0
    218 
    219 Base64 decode "Zm9vYmF\ry" (CRLF inside)
    220 base64_decode_hex_src:"5a6d3976596d460d0a79":"foobar":0
    221 
    222 Base64 decode "Zm9vYmF\ry" (CR inside)
    223 base64_decode_hex_src:"5a6d3976596d460d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    224 
    225 Base64 decode "Zm9vYmF y" (SP inside)
    226 base64_decode_hex_src:"5a6d3976596d462079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    227 
    228 Base64 decode "Zm9vYmF \ny" (SP+LF inside)
    229 base64_decode_hex_src:"5a6d3976596d46200a79":"foobar":0
    230 
    231 Base64 decode "Zm9vYmF \ry" (SP+CRLF inside)
    232 base64_decode_hex_src:"5a6d3976596d46200d0a79":"foobar":0
    233 
    234 Base64 decode "Zm9vYmF \ry" (SP+CR inside)
    235 base64_decode_hex_src:"5a6d3976596d46200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    236 
    237 Base64 decode "Zm9vYmF  y" (2SP inside)
    238 base64_decode_hex_src:"5a6d3976596d46202079":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    239 
    240 Base64 decode "Zm9vYmF  \ny" (2SP+LF inside)
    241 base64_decode_hex_src:"5a6d3976596d4620200a79":"foobar":0
    242 
    243 Base64 decode "Zm9vYmF  \ry" (2SP+CRLF inside)
    244 base64_decode_hex_src:"5a6d3976596d4620200d0a79":"foobar":0
    245 
    246 Base64 decode "Zm9vYmF  \ry" (2SP+CR inside)
    247 base64_decode_hex_src:"5a6d3976596d4620200d79":"":MBEDTLS_ERR_BASE64_INVALID_CHARACTER
    248 
    249 Base64 encode hex #1
    250 base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":13:0
    251 
    252 Base64 encode hex #2 (buffer too small)
    253 base64_encode_hex:"010203040506070809":"AQIDBAUGBwgJ":12:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
    254 
    255 Base64 encode hex #3
    256 base64_encode_hex:"0102030405060708":"AQIDBAUGBwg=":13:0
    257 
    258 Base64 encode hex #4
    259 base64_encode_hex:"01020304050607":"AQIDBAUGBw==":13:0
    260 
    261 # Rotate the bytes around so that they end up at each offset modulo 3 in
    262 # successive test cases.
    263 Base64 encode hex all valid input bytes #0
    264 base64_encode_hex:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff":"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==":345:0
    265 
    266 Base64 encode hex all valid input bytes #1
    267 base64_encode_hex:"0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff00":"AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8wMTIzNDU2Nzg5Ojs8PT4/QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl9gYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXp7fH1+f4CBgoOEhYaHiImKi4yNjo+QkZKTlJWWl5iZmpucnZ6foKGio6SlpqeoqaqrrK2ur7CxsrO0tba3uLm6u7y9vr/AwcLDxMXGx8jJysvMzc7P0NHS09TV1tfY2drb3N3e3+Dh4uPk5ebn6Onq6+zt7u/w8fLz9PX29/j5+vv8/f7/AA==":345:0
    268 
    269 Base64 encode hex all valid input bytes #2
    270 base64_encode_hex:"02030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff0001":"AgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQlJicoKSorLC0uLzAxMjM0NTY3ODk6Ozw9Pj9AQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gIGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goaKjpKWmp6ipqqusra6vsLGys7S1tre4ubq7vL2+v8DBwsPExcbHyMnKy8zNzs/Q0dLT1NXW19jZ2tvc3d7f4OHi4+Tl5ufo6err7O3u7/Dx8vP09fb3+Pn6+/z9/v8AAQ==":345:0
    271 
    272 Base64 encode all valid output characters at all offsets
    273 base64_encode_hex:"00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7effe00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7efd0":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/Q":261:0
    274 
    275 Base64 decode hex #1
    276 base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":9:0
    277 
    278 Base64 decode hex #2 (buffer too small)
    279 base64_decode_hex:"AQIDBAUGBwgJ":"010203040506070809":8:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
    280 
    281 Base64 decode hex #3
    282 base64_decode_hex:"AQIDBAUGBwg=":"0102030405060708":8:0
    283 
    284 Base64 decode hex #4
    285 base64_decode_hex:"AQIDBAUGBw==":"01020304050607":7:0
    286 
    287 Base64 decode hex #5 (buffer too small)
    288 base64_decode_hex:"AQIDBAUGBw==":"01020304050607":6:MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
    289 
    290 Base64 decode all valid input characters at all offsets
    291 base64_decode_hex:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/Q":"00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7effe00108310518720928b30d38f41149351559761969b71d79f8218a39259a7a29aabb2dbafc31cb3d35db7e39ebbf3dfbff800420c41461c824a2cc34e3d04524d45565d865a6dc75e7e08628e49669e8a6aaecb6ebf0c72cf4d76df8e7aefcf7efd0":195:0
    292 
    293 Base64 Selftest
    294 depends_on:MBEDTLS_SELF_TEST
    295 base64_selftest:
    296