bulkmail_base64_encode

one of the documented procedures in this installation of the ACS
Usage:
bulkmail_base64_encode   string
What it does:
Encode a string in base64
Defined in: /web/philip/tcl/bulkmail-base64.tcl

Source code:



    ns_share bulkmail_base64_en

    set result {}
    set state 0
    set length 0
    foreach {c} [split $string {}] {
	scan $c %c x
	switch [incr state] {
	    1 {	append result $bulkmail_base64_en([expr {($x >>2) & 0x3F}]) }
	    2 { append result $bulkmail_base64_en([expr {(($old << 4) & 0x30) | (($x >> 4) & 0xF)}]) }
	    3 { append result $bulkmail_base64_en([expr {(($old << 2) & 0x3C) | (($x >> 6) & 0x3)}])
	    append result $bulkmail_base64_en([expr {($x & 0x3F)}])
	    set state 0}
	}
	set old $x
	incr length
	if {$length >= 72} {
	    append result \n
	    set length 0
	}
    }
    set x 0
    switch $state {
	0 { # OK }
	1 { append result $bulkmail_base64_en([expr {(($old << 4) & 0x30)}])== }
	2 { append result $bulkmail_base64_en([expr {(($old << 2) & 0x3C)}])=               }
    }
    return $result


philg@mit.edu