blob: f5e7c9f8e9599b88c633f732d814c4ca5cce27ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/**
* Generic utils
* wumpus 2003 -- www.blacksphere.tk
*/
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include "wmx-util.h"
/**
* Dump raw hex
*/
void dumpraw(char *str, unsigned char *buffer, size_t length)
{
size_t x;
printf("[");
for(x=0; x<length; x++) {
if(x != (length-1)) {
printf("%02x ",buffer[x]);
} else {
printf("%02x",buffer[x]);
}
}
printf("]");
}
/**
* Integer to binary
*/
void binstr(char *dest, unsigned int value, int len)
{
int x;
for(x=len-1; x>=0; x--) {
dest[x] = '0' + (value & 1);
value >>= 1;
}
dest[len] = 0;
}
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
|