취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

binary string to hex string

해결 완료!
솔루션으로 이동

I'm sure there's a very simple solution, but I can't seem to find it anywhere.

 

I have a string that looks like this, "BÑ›c -Ûí3^¥‘¹&¯]" and I want it to look like this, "42D19B630B2DDBED335EA591B926AF5D".

I've tried typecast and unflatten without success. What function should I be using?

0 포인트
1/7 메시지
11,570 조회수
솔루션
주제 작성자 IMSargon이(가) 승인함

If you just want to see the content in hexadecimal, right-click the indicator and switch to hex display.

 

If you want to format it as a hexadecimal formatted string (2 characters/byte, using characters 0..F exclusively), you could do the following:

 

There are many other ways to do all this. Here's a loop-free version:

 

Message Edited by altenbach on 07-21-2009 10:33 AM
모두 다운로드
2/7 메시지
11,568 조회수

Thanks, your code does do what I need.

 

I should also more clear about what I am doing, so we can see if there are simpler solutions. I am writing a login using a 32 character hex hash read from a file, and comparing this to the output from the OpenG MD5 Digest function.

 

Edit: Thanks, your loop-free version looks like a good solution to me.

Message Edited by IMSargon on 07-21-2009 12:42 PM
0 포인트
3/7 메시지
11,555 조회수
Just select the Display Mode of your string indicator to HEX (Rightclick on it)
0 포인트
4/7 메시지
11,546 조회수

I don't have the openg toolkit installed at the moment. Is the output of the openG MD5 function a hexadecimal formatted string?

 

Do you need to format the string from the file or the output of the MD5?

 

You can go either way: comparing the binary strings or the hexadecimal formatted strings. Same difference.

 

I would store whatever you need to compare in the file so no conversion is needed at all.

0 포인트
5/7 메시지
11,542 조회수
The output of the MD5 function is the binary string. As of now I'm just typing the hashes into the text file, so I couldn't use the binary string in the file. This may change as I come up with a feature to allow users to change their own password.
0 포인트
6/7 메시지
11,539 조회수
Text files contain binary code, but if you open a such file with a text editor it will represent you the contained binary code as ASCII chracters.
0 포인트
7/7 메시지
11,512 조회수