Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /smlnj-lib/trunk/Util/base64-sig.sml
ViewVC logotype

View of /smlnj-lib/trunk/Util/base64-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3761 - (download) (annotate)
Mon Sep 24 13:21:03 2012 UTC (6 years, 8 months ago) by jhr
File size: 1159 byte(s)
  Working on base64 encoding/decoding.
(* base64-sig.sml
 *
 * COPYRIGHT (c) 2012 The Fellowship of SML/NJ (http://www.smlnj.org)
 * All rights reserved.
 *
 * Support for Base64 encoding/decoding as specified by RFC 4648.
 *
 *	http://www.ietf.org/rfc/rfc4648.txt
 *)

signature BASE64 =
  sig

  (* return true if a character is in the base64 alphabet *)
    val isBase64 : char -> bool

    val encode : Word8Vector.vector -> string
    val encodeSlice : Word8VectorSlice.slice -> string

  (* raised if a Base64 string does not end in a complete encoding quantum (i.e., 4
   * characters including padding characters).
   *)
    exception Incomplete

  (* raised if an invalid Base64 character is encountered during decode.  The int
   * is the position of the character and the char is the invalid character.
   *)
    exception Invalid of (int * char)

  (* decode functions that ignore whitespace *)
    val decode : string -> Word8Vector.vector
    val decodeSlice : substring -> Word8Vector.vector

  (* strict decode functions that only accept the base64 characters *)
    val decodeStrict : string -> Word8Vector.vector
    val decodeSliceStrict : substring -> Word8Vector.vector

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0