zoukankan      html  css  js  c++  java
  • Base 64 encoder/decoder for Lotus Script

    This an implementation of Base64 as described in rfc4648 (The Base16, Base32, and Base64 Data Encodings) for the Lotus Notes environment.

    Base64 is an algorithm to encode binary data into a ascii text representation. Common applications are

    • Passing credentials to web servers: HTTP Authentication: Basic and Digest Access Authentication.
    • Transferring binary data in email:For this purpose, the encoding can be run in MIME-mode to produce line breaks.
    • Transferring or storing binary data in other formats, like XML.

    This library makes use of NotesStreams and NotesMIMEEntity that came with Notes 6.

    Usage

    1. Save and unzip the code to a text file (libBase64.lss)
    2. Use Domino Designer to create a new empty Lotus Script library ‘libBase64′
    3. Import libBase64.lss and save the lib
    4. Now you can include the library (Use "libBase64") and use it:
      Dim b64 As New CBase64()
      Call b64.encode (..)

    Samples

    Encode a string to base64

    Dim b64 As New CBase64()

    	Print b64.encodeString ("foobar")
    	

    Encode a binary file to a base64 encoded file

    Dim b64 As New CBase64()

    	Call b64.encodeFileToFile (fspecInput, fspecOutput)
    	

    The result file will have line breaks at column 76. If this is not desired, than it can be suppressed. This will be a bit slower however:

    
    	Dim b64 As New CBase64()
    	b64.bMimeModeEncoding = False
    	Call b64.encodeFileToFile (fspecInput, fspecOutput)
    	

    Decode a base64 encoded file to a (probably binary) file

    Dim b64 As New CBase64()

    Call b64.decodeFileToFile (fspecInput, fspecOutput)

    	

     



  • 相关阅读:
    12.Django与ajax
    11.Django的分页器paginator
    10.中间键Middleware
    09.用户认证auth模块
    08.form组件
    07.会话跟踪技术cookie与session
    06.orm模型层
    05.Django模板层
    04.Django视图函数
    03.DjangoURL路由
  • 原文地址:https://www.cnblogs.com/hannover/p/2328940.html
Copyright © 2011-2022 走看看