b.ss
#lang scheme/base
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NET.plt
;;
;; abstraction of common network behaviors and services
;;
;; Bonzai Lab, LLC.  All rights reserved.
;;
;; Licensed under LGPL.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; b.ss - provides the b encoding defined in rfc2047
;; yc 2/13/2010 - first version.
(require "depend.ss"
         ;; b decode works exactly the same as base64-decode
         (rename-in "depend.ss" (base64-decode b-decode))
         )

;; b-encode
;; the main difference is that b-encode does not contain the trailing line-term
(define (b-encode bstr)
  (let ((bout (base64-encode bstr)))
    (subbytes bout 0 (- (bytes-length bout) (bytes-length (line-term/bytes))))))

(provide b-decode)
(provide/contract 
 (b-encode (-> bytes? bytes?))
 )