$nav ===== Function: llBase64ToInteger ===== integer llBase64ToInteger(string base64str) Converts a string containing an integer in $lart[Base64] representation to integer. $art[Base64] is a fairly compact way to store any arbitrary 32-bit integer in a string, especially if the numbers can usually be big. ===== Parameters ===== === base64str === A $lty[string] expressed in $lart[Base64] that represents the four bytes of a 32-bit integer. ===== Return value ===== The $lty[integer] that the string represents, or zero if the string is more than 8 characters long. ===== Notes ===== * Strings with more than 8 characters cause the output to be 0. * Padding is ignored; parsing proceeds until the first non-$art[Base64] character is found. * The implementation converts from $art[Base64] to a string of bytes, and appends a null byte at the end. If the result has less than four bytes, garbage bytes will result. * The bytes in the binary form of the $art[Base64] string are always interpreted in big endian order (most-significant byte first). Extra non-zero trailing bits in the last $art[Base64] digit are accepted and ignored. Incomplete bytes are not output, e.g. a string with one single character acts as an empty string. ===== Short examples ===== integer i; i = llBase64ToInteger("ABCDEF=="); // sets i to 1082128 // (A = 000000, B = 000001, C = 000010, ... so the binary // number is 00000000000100001000011100010000 which // in decimal is 1082128; note some bits of the binary // representation of F are truncated) i = llBase64ToInteger("ABCDEF"); // same as above i = llBase64ToInteger("ABCDEA"); // same as above i = llBase64ToInteger(""); // sets i to some number between 0 and 16777215 // (the appended 0 goes to the most significant byte // and the rest are filled with garbage) ===== See also ===== * $lfn[llIntegerToBase64] encodes an integer in the $lart[Base64] format that this function decodes. * $lfn[llBase64ToString] and $lfn[llStringToBase64] convert to/from a UTF-8 encoded string instead of integer. * $lfn[llXorBase64] calculates the bitwise XOR of corresponding bytes represented by two $art[Base64] strings, byte by byte.