File: hexdraw

package info (click to toggle)
unifont 1%3A1.0-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,372 kB
  • ctags: 2
  • sloc: perl: 113; makefile: 40
file content (23 lines) | stat: -rwxr-xr-x 357 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl -p

sub unpack { 
	local ($_) = @_;
	$_ = unpack ("B*", pack ("H*", $_));
	$width=length($_)/16;
	s/(.{$width})/\t$1\n/g;
	y/01/-#/;
	$_;
};

sub pack { 
	local ($_) = @_; 
	y/-#/01/;
	$_= unpack ("H*", pack ("B*", $_));
	y/a-f/A-F/;
	$_;
}

s/([0-9A-F]{64})/&unpack($1)/ie || 
s/([0-9A-F]{32})/&unpack($1)/ie ||
s/\t([-#]+)\n/&pack($1)/e;