17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc. 37c478bd9Sstevel@tonic-gate * All rights reserved. 47c478bd9Sstevel@tonic-gate */ 57c478bd9Sstevel@tonic-gate 67c478bd9Sstevel@tonic-gate #include <stdlib.h> 77c478bd9Sstevel@tonic-gate #include <string.h> 87c478bd9Sstevel@tonic-gate #include <ctype.h> 97c478bd9Sstevel@tonic-gate 107c478bd9Sstevel@tonic-gate static char hexdig[] = "0123456789abcdef"; 117c478bd9Sstevel@tonic-gate hexa_print(char * aString,int aLen)127c478bd9Sstevel@tonic-gatechar* hexa_print(char *aString, int aLen) 137c478bd9Sstevel@tonic-gate { 147c478bd9Sstevel@tonic-gate char *res; 157c478bd9Sstevel@tonic-gate int i =0; 16*1da57d55SToomas Soome 177c478bd9Sstevel@tonic-gate if ((res = (char *)calloc (aLen*2 + 1, 1 )) == NULL){ 187c478bd9Sstevel@tonic-gate return (NULL); 197c478bd9Sstevel@tonic-gate } 207c478bd9Sstevel@tonic-gate for (;;){ 217c478bd9Sstevel@tonic-gate if (aLen < 1) 227c478bd9Sstevel@tonic-gate break; 237c478bd9Sstevel@tonic-gate res[i] = hexdig[ ( *aString & 0xf0 ) >> 4 ]; 247c478bd9Sstevel@tonic-gate res[i + 1] = hexdig[ *aString & 0x0f ]; 257c478bd9Sstevel@tonic-gate i+= 2; 267c478bd9Sstevel@tonic-gate aLen--; 277c478bd9Sstevel@tonic-gate aString++; 287c478bd9Sstevel@tonic-gate } 297c478bd9Sstevel@tonic-gate return (res); 307c478bd9Sstevel@tonic-gate } 31