Defined in
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
-
No testcase defined.
Source code:
if {[string length $string] == 0} {return ""}
set base64 $::base64::base64
set output "" ;
binary scan $string c* X
foreach x $X {
set bits [lindex $base64 $x]
if {$bits >= 0} {
if {[llength [lappend nums $bits]] == 4} {
foreach {v w z y} $nums break
set a [expr {($v << 2) | ($w >> 4)}]
set b [expr {(($w & 0xF) << 4) | ($z >> 2)}]
set c [expr {(($z & 0x3) << 6) | $y}]
append output [binary format ccc $a $b $c]
set nums {}
}
} elseif {$bits == -1} {
foreach {v w z} $nums break
if {$w == {}} {
return -code error "Not enough data to process padding"
}
set a [expr {($v << 2) | (($w & 0x30) >> 4)}]
if {$z == {}} {
append output [binary format c $a ]
} else {
set b [expr {(($w & 0xF) << 4) | (($z & 0x3C) >> 2)}]
append output [binary format cc $a $b]
}
break
} else {
continue
}
}
return $output
XQL Not present:Generic, PostgreSQL, Oracle