Giter VIP home page Giter VIP logo

base64-clj's Introduction

base64-clj

Convert Data to Base64 and back in a reasonable amount of time.

Build Status endorse

This is at least as fast as the Apache Commons Base64 Codec (whose just-as-simple usage you can see here), but slower than Alexander Taggart's data.codec.

Usage

Leiningen

[base64-clj "0.1.1"]

REPL

(require '[base64-clj.core :as base64])

(base64/encode "Hello, World!")
;; => "SGVsbG8sIFdvcmxkIQ=="
(base64/decode "SGVsbG8sIFdvcmxkIQ==")
;; => "Hello, World!"

(base64/encode-bytes (.getBytes "Hello, World!"))
;; => #<byte[] [B@28a34522>
(base64/decode-bytes (.getBytes "SGVsbG8sIFdvcmxkIQ=="))
;; => #<byte[] [B@18b0af83>

(base64/encode "ÄÖÜ" "ISO-8859-1")
;; => "xNbc"
(base64/encode "ÄÖÜ" "UTF-8")
;; => "w4TDlsOc"

(base64/decode "xNbc")
;; => "???"
(base64/decode "xNbc" "ISO-8859-1")
;; => "ÄÖÜ"

Tests

You can run Midje tests using the following Leiningen command:

lein midje

Benchmarks

You can run Criterium benchmarks on different Base64 codecs with the following Leiningen command:

lein benchmark base64-clj-benchmark.<ID> [--quick]

ID is one of:

  • base64-clj : evaluate this project
  • base64-naive : evaluate a naive and intuitive implementation
  • apache-commons-base64 : evaluate the Apache Commons Codec
  • clojure-data-codec : evaluate clojure.data.codec.base64

License

Copyright © Yannick Scherer

Distributed under the Eclipse Public License, the same as Clojure.

base64-clj's People

Contributors

adamfrey avatar xsc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.