Module Base64

Base 64 encoding of strings is typically used to "scramble" transmitted passwords when accessing web pages that require user authentication. The typical pattern for basic HTTP authentication is as follows:

import Base64;

 

var A = "Basic " + Base64_Encode("user:pw");

var P = GetURL( "http://...",

[..], [. Authorization = A .]);

 

In the code above user must be set to the user name and pw to the authentication password. The last object passed to the GetURL function contains the authentication header to send to the web server.

The Base64 module is also used when authenticating users to Web proxies by adding a Proxy-Authorization header to the HTTP request:

import Base64;

 

var A = "Basic " + Base64_Encode("user:pw");

var P = GetURL(url, nil,

[. "Proxy-Authorization" = A .]);

 

Module Base64

Function

Description

Encode(s: string): string

Encodes a string in the base64 encoding.

Decode(s: string): string

Decodes a string in base64 encoding.

 


Up Previous Next