675
edits
(Add per-cell protection) |
m (minor typo) |
||
Line 56: | Line 56: | ||
The base64 table as used by the format is as follows: <code>ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/</code> | The base64 table as used by the format is as follows: <code>ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/</code> | ||
In order to decode the base64 string, the "@" character must first be stripped. Then, all characters must be iterated through. The base64 character must be converted to its index within the base64 table. Each base64 character holds information for three cells. To retrieve the information for the next three characters, the respective formulas are used: <code>idx >> 4 & 3</code>; <code>idx >> 2 & 3</code>; <code>idx & 3</code>. To allow for the proper encoding of protection information in base64, the writability values are shifted up by one and null is assigned 0. When decoding, the numbers are shifted down by one and what was originally zero is assigned null. To re-encode the string, the "@" character must first be added to indicate the base64 type. Then, the following formula is used for the next three characters: <code>c1 << 4 | c2 << 2 | c3</code>. If no characters are left, the value 0 is substituted. The final step is to convert the | In order to decode the base64 string, the "@" character must first be stripped. Then, all characters must be iterated through. The base64 character must be converted to its index within the base64 table. Each base64 character holds information for three cells. To retrieve the information for the next three characters, the respective formulas are used: <code>idx >> 4 & 3</code>; <code>idx >> 2 & 3</code>; <code>idx & 3</code>. To allow for the proper encoding of protection information in base64, the writability values are shifted up by one and null is assigned 0. When decoding, the numbers are shifted down by one and what was originally zero is assigned null. To re-encode the string, the "@" character must first be added to indicate the base64 type. Then, the following formula is used for the next three characters: <code>c1 << 4 | c2 << 2 | c3</code>. If no characters are left, the value 0 is substituted. The final step is to convert the value into a base64 character and then append it to the string. | ||
== Per-Cell Links == | == Per-Cell Links == |