yEncode - V1: formal specification proposal (25. Feb 2002) ------------------------------------------------------------------------------ General: yEncode is a general efficient method to encode an 8 bit binary for net-transport or storage when just a specific amount of character-codes is critical and must be avoided. yEncoding can be used (for example) in Usenet messages, eMail messages or as a block in a file. This formal spec contains extensions for yEnc-V2 - marked by: // yEnc-V2 Purpose: This proposal is made to describe the actual status - and possible future expansions. It is not a part of yEnc yet. Notation: { } // Repetition [ ] // Optional // // Comment | // Or - alternatively // Item CR // single characters Usenet-Messages ------------------------ := [ ] { [ ] } n times := { | // or } n times := CRLF := any text - but CRLF=ybegin := [ ] // optional for multiparts [] // yEnc-V2 - tbd. := CRLF // This requires an empty line between two encoded binaries in one message =ybegin | (or) =ybegin2 (for yEnc-V2) SPACE CRLF := { { | // or } until is reached or exceeded (or binary is done) CRLF } // until binary is done - or part is complete := =yend := SPACE SPACE := line= := unsigned integer. (Range: 63-998) // Lines have this size // - or this size+1 if the 2nd last char is the escape character := size= := unsigned integer: Size of the original binary (Range: 1 - 2^62-1) // It is not permitted to encode binaries with the size NULL! := name= ASCII-string // (The name of the binary when stored to disk OK) // In case of corruption: CRLF // The ASCII string must only contain chars from ASCII 32-ASCII 127 // Leading or tailing spaces (ASCII 32) are generally ignored // The string must not be empty // Characters which are not available on the platform are replaced // by Underscore at decoding time // These characters are not permitted: / \ : < >" @ // These character are permitted!: [ ] ( ) := SPACE // identical to the in the CRLF := ( + ) modulo 256 // Permitted for the transport medium := ( + + ) modulo 256 := 42 // default | // Or // if present in // yEnc-V2 := = // default // Or // if present in // yEnc-V2 := 64 // Or // if present in // yEnc-V2 := + is not allowed on the medium | CR, LF, NULL , on Usenet | CR,LF,NULL, '>' in HTML and XML // yEnc-V2 | TAB, SPACE as the first or last character in the encoded line (eMail) // yEnc-V2 | DOT as the first character on Usenet := { SPACE } n times part= // requires | // or total= // requires "part=" yEnc-V2 | // or // yEnc-V2 | // or // yEnc-V2 | // or // yEnc-V2 | // or // yEnc-V2 | // // yEnc-V2 := Unsigned integer (1-999) // part-number for splitted binaries := Unsigned integer (1-999) // total number of part during encoding // 1 is possible - this is a splitted message with one part := offset= <42> // on Usenet '*' | (0-255) // by medium and optimization - yEnc V2 // Must not result in =y at start of a line | 0 // for 1-1 encoding - only escaping critical chars := escape= '=' // on Usenet: ASCII 61 (0-255) // by medium and optimization - yEnc V2 // Must not result in =y at start of a line := escoff= <64> // on Usenet (1-255) // by medium and optimization - yEnc V2 // Must not result in =y at start of a line // Cannot be NULL 0 := crc32= 8 char hexvalue // Representing the 8-bit CRC32 of the encoded binary // Leading 0's required - fixed size parameter ! := // yEnc - V2 comp= := // yEnc - V2 zip | rar | gzip | rle | // if the method is unknown then the decoder must write the decoded binary // to disk "as is" and expand the filename with a DOT and this identifier // for an external decoder. := { SPACE } n times [ part= // identical to upper appearance partcrc= // required if "part=" is used ] | // or // identical to upper appearance (if used in =ybegin) := pcrc32= 8 char hexvalue // Representing the 8-bit CRC32 of the encoded binary part // since // Leading 0's required - fixed size parameter ! := =ypart SPACE begin= SPACE end= CRLF := unsingned integer (1 - 2<62-1) // the position of the first byte in the originally encoded binary in // Remark: The first byte in a binary has the position 1 (one) := unsingned integer (2 - 2<62-1) // the position of the last byte in the originally encoded binary in // Always smaller than // Remark: The last byte in a binary has the position identically to the size of it. := { // with and all other partial info required } n times := Subject: SPACE [ SPACE] // optional - for the user (layer-8) " " SPACE SPACE yEnc [SPACE ] // required for multipart SPACE SPACE bytes [SPACE ] // Optional for the user (layer-8) CRLF Any text - not including (*/*) // * = any text | Any text - not including these characters: ( / ) " // yEnc-V2 Any text - not including (*/*) and [*/*] // * = any text Any text - not including these characters: ( / ) [ ] " // yEnc-V2 := ( / ) := // If decoding worked properly | // or with illegal characters change to underscore '_' | // or ( ). := corrupt | <42> := integer value 42 // Good "rotation value" for common binary formats. // Proof is in progress and will be done in the future // (see: Hitchhikers Guide to the Galaxy) <64> := Integer value 64 // This value converts CRLF into =M=J // This is a commonly used abbreviation (CTRL+M, CTRL+J) { =ydata SPACE CRLF } n times := // tbd. := // N/A ;-) -- End of doc