Na githubie udostępniam swoją implementację dekodera, która używa biblioteki libucl1-dev
. Kod znajdujący się w tym repozytorium w całości pochodzi z przykładów w/w biblioteki opracowanej w latach '90 i wydanej na licencji GPL.
https://github.com/icedevml/decode-polish-aztec
Wysyłanie nieprawidłowych DMCA względem tego repozytorium spowoduje podjęcie działań w kierunku ukarania za składanie fałszywych zeznań.
Załączam kod poniżej:
decompress_polish_aztec.c
/* decompress_polish_aztec.c -- decompress data from polish vehicle AZTEC code
this file is an explicit modification of the following file from libucl1-dev:
simple.c -- the annotated simple example program for the UCL library
This file is part of the UCL data compression library.
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The UCL library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The UCL library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the UCL library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<[email protected]>
http://www.oberhumer.com/opensource/ucl/
*/
#include <ucl/ucl.h>
#if defined(UCL_USE_ASM)
# include <ucl/ucl_asm.h>
#endif
/* portability layer */
#define WANT_UCL_MALLOC 1
#include "portab.h"
#include <unistd.h>
int __acc_cdecl_main main(int argc, char *argv[])
{
int r;
ucl_bytep in;
ucl_bytep out;
ucl_uint in_len;
ucl_uint out_len;
ucl_uint new_len;
int level = 5; /* compression level (1-10) */
if (argc < 0 && argv == NULL) /* avoid warning about unused args */
return 0;
fprintf(stderr, "\nUCL data compression library (v%s, %s).\n",
ucl_version_string(), ucl_version_date());
fprintf(stderr, "Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer\n");
fprintf(stderr, "http://www.oberhumer.com/opensource/ucl/\n\n");
/*
* Step 1: initialize the UCL library
*/
if (ucl_init() != UCL_E_OK)
{
fprintf(stderr, "internal error - ucl_init() failed !!!\n");
fprintf(stderr, "(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable `-DUCL_DEBUG' for diagnostics)\n");
return 1;
}
/*
* Step 2: setup memory
*
* We want to compress the data block at `in' with length `in_len' to
* the block at `out'. Because the input block may be incompressible,
* we must provide a little more output space in case that compression
* is not possible.
*/
in_len = 256 * 1024L;
out_len = 256 * 1024L;
in = (ucl_bytep) ucl_malloc(in_len);
out = (ucl_bytep) ucl_malloc(out_len);
if (in == NULL || out == NULL)
{
fprintf(stderr, "out of memory\n");
return 2;
}
ucl_uint rout_len = 0;
rout_len = read(STDIN_FILENO, out, out_len);
/*
* Step 5: decompress again, now going back from `out' to `in'
*/
new_len = out_len;
r = ucl_nrv2e_decompress_8(out+4,rout_len-4,in,&new_len,NULL);
if (r == UCL_E_OK)
for (int i = 0; i < new_len; i++) {
printf("%c", in[i]);
}
else
{
/* this should NEVER happen */
fprintf(stderr, "internal error - decompression failed: %d\n", r);
return 5;
}
ucl_free(out);
ucl_free(in);
return 0;
}
/*
vi:ts=4:et
*/
portab.h
/* portab.h -- portability layer
This file is part of the UCL data compression library.
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The UCL library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The UCL library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the UCL library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<[email protected]>
http://www.oberhumer.com/opensource/ucl/
*/
#include <ucl/uclconf.h>
#if 0
#include "examples/portab_a.h"
#else
/* INFO:
* The "portab_a.h" version above uses the ACC library to add
* support for ancient systems (like 16-bit DOS) and to provide
* some gimmicks like win32 high-resolution timers.
* Still, on any halfway modern machine you can also use the
* following pure ANSI-C code instead.
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#undef NDEBUG
#include <assert.h>
#define __acc_cdecl_main
#define ACC_UNUSED(var) ((void) &var)
#if defined(WANT_UCL_MALLOC)
# define ucl_malloc(a) (malloc(a))
# define ucl_free(a) (free(a))
#endif
#if defined(WANT_UCL_FREAD)
# define ucl_fread(f,b,s) (fread(b,1,s,f))
# define ucl_fwrite(f,b,s) (fwrite(b,1,s,f))
#endif
#if defined(WANT_UCL_UCLOCK)
# define ucl_uclock_handle_t int
# define ucl_uclock_t double
# define ucl_uclock_open(a) ((void)(a))
# define ucl_uclock_close(a) ((void)(a))
# define ucl_uclock_read(a,b) *(b) = (clock() / (double)(CLOCKS_PER_SEC))
# define ucl_uclock_get_elapsed(a,b,c) (*(c) - *(b))
#endif
#if defined(WANT_UCL_WILDARGV)
# define ucl_wildargv(a,b) ((void)0)
#endif
#endif
/*
vi:ts=4:et
*/
Użycie:
$ sudo apt install libucl1-dev
$ g++ -o decompress decompress_polish_aztec.c -lucl
$ cat vehicle.bin
BgQAANtYAAJDAPkxAHwAQXIw7zcGNN4ANiox+w81HrUGOP8eUABSAEUA+1oAWQBEDv9OAFQAIABN3wAuClMAvlQPV/eKUhq9Wg5X7k58UtcWSVq9TF5J79pBZ+5PAEsG12bTSm5GVQBM/ntSAEH7L1dj+0MAS1vvMvovewo3Ut4wDi39HjEAN6Pbl0FNe3YgPt5Q3kv3IlSevVnX1z9FMmuCShL2WgBaG9umKADvSAApJnx75k+itwZMAEx9X0rvbkSOTXtOOF/DRy0WOW53fPYLFoMzLr0xAi3DGnevLQOCfJ/vQZ5TcBZrN0oa9k4AfA82Q4QaDzj3q8deN6sN7zIE/1x8lbMnQdwBQi5ZT86jL2tqNAr2MwAw34xSH+uPSVPYFxZThBMzON8AMJM5wQA3MwRcMX7bNcET2jInwyedE01HZ4dlM94qKy0DL38fNgAqeBszSxOvNIeKfHM7fCLxNQAwVkMtdzl7Xiw/YMyrFzxQACBWw+Hza7c3C93/NWuHg1OWRquPQ5KP02K9IBZT4QZC9oNZU7aXFiOX83U4ADJFC7ADhrNVCyOW8w9qMbEnZhdHbHxjdjIT7E4DW0M3OQuGaxYmCSSSSSr/
$ base64 -d vehicle.bin | ./decompress | iconv -f UCS-2LE -t UTF-8//TRANSLIT
UCL data compression library (v1.03, Jul 20 2004).
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
http://www.oberhumer.com/opensource/ucl/
XXC1|AAA0007046|1465058|PREZYDENT M. ST. WARSZAWY|DZIELNICA MOKOTÓW|UL. RAKOWIECKA 25/27|02-517 WARSZAWA|DMI 1PNK|TOYOTA|E12J|ZZE120(H)||COROLLA|JTDKM28E100089120|2013-11-06|---|KOWALSKI JAN|JAN|KOWALSKI||82091711022|02-517|WARSZAWA||WAŁBRZYSKA|24|30|KOWALSKA MARIA|MARIA|KOWALSKA||88030971022|02-517|WARSZAWA||WAŁBRZYSKA|24|30|1655|1655|2655|1205|M1|e11*2001/116*0180*04|2|1000|450|---|1398,00|71,00|P |2005-07-01|5|---|SAMOCHÓD OSOBOWY|---|2005|---|8,82|AAA0000000|02650008000158|03|02|000|2000NNNNNNNN|009002001|