~ubuntu-branches/debian/sid/upx-ucl/sid

« back to all changes in this revision

Viewing changes to src/stub/scripts/bin2h.pl

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2006-06-13 21:23:23 UTC
  • mfrom: (1.3.1 upstream) (3.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20060613212323-343yzs4jt6vr5483
* New upstream version.
* Standards-Version: 3.7.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#
5
5
#  This file is part of the UPX executable compressor.
6
6
#
7
 
#  Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
8
 
#  Copyright (C) 1996-2004 Laszlo Molnar
 
7
#  Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
 
8
#  Copyright (C) 1996-2006 Laszlo Molnar
 
9
#  Copyright (C) 2000-2006 John F. Reiser
9
10
#  All Rights Reserved.
10
11
#
11
12
#  UPX and the UCL library are free software; you can redistribute them
30
31
 
31
32
use Compress::Zlib;
32
33
 
33
 
 
34
34
$delim = $/;
35
35
undef $/;       # undef input record separator - read file as a whole
36
36
 
81
81
 
82
82
   This file is part of the UPX executable compressor.
83
83
 
84
 
   Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
85
 
   Copyright (C) 1996-2004 Laszlo Molnar
 
84
   Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
 
85
   Copyright (C) 1996-2006 Laszlo Molnar
 
86
   Copyright (C) 2000-2006 John F. Reiser
86
87
   All Rights Reserved.
87
88
 
88
89
   UPX and the UCL library are free software; you can redistribute them
110
111
 
111
112
$s = $ident;
112
113
$s =~ tr/a-z/A-Z/;
 
114
printf("#define %s_SIZE    %d\n", $s, $n);
113
115
printf("#define %s_ADLER32 0x%08x\n", $s, &adler32($data));
114
116
printf("#define %s_CRC32   0x%08x\n", $s, &crc32($data));
115
117
printf("\n");
138
140
undef $delim;
139
141
exit(0);
140
142
 
141
 
 
142
 
# /***********************************************************************
143
 
# //
144
 
# ************************************************************************/
145
 
 
146
 
sub adler32_OLD {
147
 
    local($d) = @_;
148
 
    local($n) = length($d);
149
 
    local($i);
150
 
    local($s1) = 1;
151
 
    local($s2) = 0;
152
 
 
153
 
    for ($i = 0; $i < $n; $i++) {
154
 
        $s1 += ord(substr($d, $i, 1));
155
 
        $s2 += $s1;
156
 
        $s1 %= 65521;
157
 
        $s2 %= 65521;
158
 
    }
159
 
 
160
 
    return ($s2 << 16) | $s1;
161
 
}
162
 
 
163
143
# vi:ts=4:et