Ascii85 Codec

Provides methods for encoding bytes to and decoding strings from the Ascii85 format.

License

License

GroupId

GroupId

com.github.fzakaria
ArtifactId

ArtifactId

ascii85
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

Ascii85 Codec
Provides methods for encoding bytes to and decoding strings from the Ascii85 format.
Project URL

Project URL

https://github.com/fzakaria/ascii85
Source Code Management

Source Code Management

https://github.com/fzakaria/ascii85

Download ascii85

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.fzakaria/ascii85/ -->
<dependency>
    <groupId>com.github.fzakaria</groupId>
    <artifactId>ascii85</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.fzakaria/ascii85/
implementation 'com.github.fzakaria:ascii85:1.2'
// https://jarcasting.com/artifacts/com.github.fzakaria/ascii85/
implementation ("com.github.fzakaria:ascii85:1.2")
'com.github.fzakaria:ascii85:jar:1.2'
<dependency org="com.github.fzakaria" name="ascii85" rev="1.2">
  <artifact name="ascii85" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.fzakaria', module='ascii85', version='1.2')
)
libraryDependencies += "com.github.fzakaria" % "ascii85" % "1.2"
[com.github.fzakaria/ascii85 "1.2"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Ascii85

Maven Central

<dependency>
  <groupId>com.github.fzakaria</groupId>
  <artifactId>ascii85</artifactId>
  <version>1.2</version>
</dependency>

This is a very simple project with a Ascii85/Base85 codec (decoder & encoder). The version most similar to what is implemented is the Adobe Version.

This codec supports:

  1. using u to pad the last block
  2. using z as a short form for all-zero group

In Ascii85-encoded blocks, whitespace and line-break characters may be present anywhere, including in the middle of a 5-character block, but they must be silently ignored.

Ascii85, also called Base85, is a form of binary-to-text encoding developed by Paul E. Rutter for the btoa utility. By using five ASCII characters to represent four bytes of binary data (making the encoded size ¹⁄₄ larger than the original, assuming eight bits per ASCII character), it is more efficient than uuencode or Base64, which use four characters to represent three bytes of data (¹⁄₃ increase, assuming eight bits per ASCII character).

Ascii85

There are some included test cases that use the example given in the wiki link above.

    @Test
    public void basicWikiDecodeTest() {
        String encodedString = "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>[email protected]$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!," +
                "O<DJ+*.@<*K0@<6L(Df-\\0Ec5e;DffZ(EZee.Bl.9pF\"AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKY" +
                "i(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIa" +
                "l(DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G" +
                ">uD.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c";

        String solution = "Man is distinguished, not only by his reason, but by this singular passion from other animals, "+
                "which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation "+
                "of knowledge, exceeds the short vehemence of any carnal pleasure.";
        assertThat(solution, is(new String(Ascii85.decode(encodedString), StandardCharsets.US_ASCII)));
    }

Versions

Version
1.2
1.1