encoding_20text_20into_20base64
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| encoding_20text_20into_20base64 [2018/03/31 13:19] – external edit 127.0.0.1 | encoding_20text_20into_20base64 [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ====== Encoding Text into Base64 ====== | ====== Encoding Text into Base64 ====== | ||
| It can be useful to encode a text string into a base 64 representation. For example when passing usernames and passwords to an SMTP server the request and response are both done using base 64.\\ The encoding is done by taking 3 ASCII values to form a 24bit binary value end then splitting this into 6 bit chunks starting from the left hand side. If there are less then 3 characters at the end then we pad out with zeroes and add one or 2 == signs to the end of the Base64 string\\ \\ | It can be useful to encode a text string into a base 64 representation. For example when passing usernames and passwords to an SMTP server the request and response are both done using base 64.\\ The encoding is done by taking 3 ASCII values to form a 24bit binary value end then splitting this into 6 bit chunks starting from the left hand side. If there are less then 3 characters at the end then we pad out with zeroes and add one or 2 == signs to the end of the Base64 string\\ \\ | ||
| + | <code bb4w> | ||
| REM Base 64 Endode and Decode | REM Base 64 Endode and Decode | ||
| INPUT "Enter String to be encoded:" | INPUT "Enter String to be encoded:" | ||
| Line 10: | Line 11: | ||
| PRINT B$ | PRINT B$ | ||
| END | END | ||
| - | \\ \\ | + | </ |
| ---- | ---- | ||
| The program uses the following Function to encode the input string and return the Base64 Encoded Text\\ | The program uses the following Function to encode the input string and return the Base64 Encoded Text\\ | ||
| + | <code bb4w> | ||
| REM Function to Encode a string into Base64 | REM Function to Encode a string into Base64 | ||
| DEF FNEncode64(text$) | DEF FNEncode64(text$) | ||
| Line 38: | Line 40: | ||
| ENDWHILE | ENDWHILE | ||
| =output$ | =output$ | ||
| - | + | </ | |
| \\ \\ And also this function to Decode a Base64 string back to a standard ASCII String\\ | \\ \\ And also this function to Decode a Base64 string back to a standard ASCII String\\ | ||
| + | <code bb4w> | ||
| REM Function to decode a Base64 string into ASCII | REM Function to decode a Base64 string into ASCII | ||
| DEF FNDecode64(B64$) | DEF FNDecode64(B64$) | ||
| Line 69: | Line 72: | ||
| =output$ | =output$ | ||
| - | + | </ | |
encoding_20text_20into_20base64.1522502358.txt.gz · Last modified: 2024/01/05 00:18 (external edit)