$z no longer needed, 234

 Code:
function a($s, optional $k,$c,$e,$p,$)
  For $c=1 To ($s^)
    $=$+($=)*128
    $p=substr($s,$c,1)
    if $k
      ;Encode
;      For $z=1 to 8
      For $e=1 to 8
        $a=$a+iif(asc($p) & $, iif($k=" ","	"," "), $k)
	$=$/2
      Next
    else
      ;Decode
      $e=$*(right($s,1)<>$p)+$e
      $=$/2
      if $=0
        $a=$a+chr($e)
        $e=0
      endif
    endif
  Next
  $a=$a+$k
endfunction
_________________________
!

download KiXnet