09-20-2006
converting character string to hex string
HI
Hi I have a character string which contains some special characters and I need it to display as a hex string.
For example, the sample i/p string: ×¥ïA Å gïÛý and
the o/p should be : D7A5EF4100C5010067EFDBFD
Any pointers or sample code pls.
10 More Discussions You Might Find Interesting
1. Programming
Hi All,
My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ','
This has to be done for all the hexstring char* is NULL.
Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies
2. Shell Programming and Scripting
I am trying to match a character return from a website so that I can replace it. It is the '...' character (didnt even know it existed initially). The character apparently has the hex value of 2026, but in the script, attempting to substitute regular 3 periods is not working.
What am I... (2 Replies)
Discussion started by: Guyverix
2 Replies
3. Programming
Hello all. I need help...
How can I cenvert this 42ec93df826c804ea531c56594db453d54daad4b to normal text? What convertor I have to use?
Thanks. (12 Replies)
Discussion started by: escudo
12 Replies
4. Programming
I want it to ouput "abcd", but it dosen't.
1 #include<stdio.h>
2 int main()
3 {
4 printf("a\x62cd");
5 }
6
gcc alarm.c -o alarm
alarm.c: In function 'main':
alarm.c:4:9: warning: hex escape sequence out of range
It seems that the complier joint "cd" as part of... (8 Replies)
Discussion started by: vistastar
8 Replies
5. Shell Programming and Scripting
Hi Guys,
writing a small shell script, i need to convert parts of a string to "Hex". The problem is that it is not the full string that needs to be converted.
I think it's best to show an example:
$astring = "xxxxxx ABC+10+##########+DEF xxxx"
This is only an example to show how the... (9 Replies)
Discussion started by: HansHansen
9 Replies
6. Shell Programming and Scripting
i have this below string which i need to convert it to HEX. i have already tried it but it showing extra few things on it.. let me show what i have done and what is the output i am getting and what is the desired output
the input string is
"!\"\"\"\"\"\"\"!\"\"\"\"\"\"\""
which is... (4 Replies)
Discussion started by: vivek d r
4 Replies
7. Shell Programming and Scripting
I have this below string in a variable
cutString=21222222222222222122222222222222
this string is nothing but hex values depicted as below
21:22:22:22:22:22:22:22:21:22:22:22:22:22:22:22
so what i want to achieve is swap the lower order with higher order values in the... (3 Replies)
Discussion started by: vivek d r
3 Replies
8. Shell Programming and Scripting
Hi,
Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank.
Text file :
"1"|"ExternalClassDEA519CF5"|"Art1"
"2"|"ExternalClass563EA516C"|"Art3"
"3"|"ExternalClass305ED16B8"|"Art9"
...
...
... (2 Replies)
Discussion started by: fspalero
2 Replies
9. Shell Programming and Scripting
I have a long string of hex (from ASN.1 data) where I need to find and change a particular hex value only and increment it. The hex pairs either side (84 and a7) of the value to increment will remain constant.
i.e. "84 <length> <value_to_increment> a7" starting with 00.
So end result:
... (11 Replies)
Discussion started by: securegooner
11 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I'm looking to split the following hex string into rows of four elements.
I've tried the following but it doesn't seem to work. How can I tell sed to match based on a pair of number(s) and letter(s), and add a newline every 4 pairs?
In addition, I need to add another newline after every... (5 Replies)
Discussion started by: sand1234
5 Replies
LEARN ABOUT REDHAT
asn1_string_print_ex
ASN1_STRING_print_ex(3) OpenSSL ASN1_STRING_print_ex(3)
NAME
ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp - ASN1_STRING output routines.
SYNOPSIS
#include <openssl/asn1.h>
int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
int ASN1_STRING_print(BIO *out, ASN1_STRING *str);
DESCRIPTION
These functions output an ASN1_STRING structure. ASN1_STRING is used to represent all the ASN1 string types.
ASN1_STRING_print_ex() outputs str to out, the format is determined by the options flags. ASN1_STRING_print_ex_fp() is identical except it
outputs to fp instead.
ASN1_STRING_print() prints str to out but using a different format to ASN1_STRING_print_ex(). It replaces unprintable characters (other
than CR, LF) with '.'.
NOTES
ASN1_STRING_print() is a legacy function which should be avoided in new applications.
Although there are a large number of options frequently ASN1_STRFLAGS_RFC2253 is suitable, or on UTF8 terminals ASN1_STRFLAGS_RFC2253 &
~ASN1_STRFLAGS_ESC_MSB.
The complete set of supported options for flags is listed below.
Various characters can be escaped. If ASN1_STRFLGS_ESC_2253 is set the characters determined by RFC2253 are escaped. If ASN1_STR-
FLGS_ESC_CTRL is set control characters are escaped. If ASN1_STRFLGS_ESC_MSB is set characters with the MSB set are escaped: this option
should not be used if the terminal correctly interprets UTF8 sequences.
Escaping takes several forms.
If the character being escaped is a 16 bit character then the form "WXXXX" is used using exactly four characters for the hex representa-
tion. If it is 32 bits then "UXXXXXXXX" is used using eight characters of its hex representation. These forms will only be used if UTF8
conversion is not set (see below).
Printable characters are normally escaped using the backslash '' character. If ASN1_STRFLGS_ESC_QUOTE is set then the whole string is
instead surrounded by double quote characters: this is arguably more readable than the backslash notation. Other characters use the "XX"
using exactly two characters of the hex representation.
If ASN1_STRFLGS_UTF8_CONVERT is set then characters are converted to UTF8 format first. If the terminal supports the display of UTF8
sequences then this option will correctly display multi byte characters.
If ASN1_STRFLGS_IGNORE_TYPE is set then the string type is not interpreted at all: everything is assumed to be one byte per character. This
is primarily for debugging purposes and can result in confusing output in multi character strings.
If ASN1_STRFLGS_SHOW_TYPE is set then the string type itself is printed out before its value (for example "BMPSTRING"), this actually uses
ASN1_tag2str().
The content of a string instead of being interpreted can be "dumped": this just outputs the value of the string using the form #XXXX using
hex format for each octet.
If ASN1_STRFLGS_DUMP_ALL is set then any type is dumped.
Normally non character string types (such as OCTET STRING) are assumed to be one byte per character, if ASN1_STRFLAGS_DUMP_UNKNOWN is set
then they will be dumped instead.
When a type is dumped normally just the content octets are printed, if ASN1_STRFLGS_DUMP_DER is set then the complete encoding is dumped
instead (including tag and length octets).
ASN1_STRFLGS_RFC2253 includes all the flags required by RFC2253. It is equivalent to:
ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB |
ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN ASN1_STRFLGS_DUMP_DER
SEE ALSO
X509_NAME_print_ex(3), ASN1_tag2str(3)
HISTORY
TBA
0.9.7a 2002-11-11 ASN1_STRING_print_ex(3)