.net byte vs java byte

풀그림 2008. 3. 16. 13:07
So a byte is a byte is a byte unless it is not! That in one sentence sums up my findings from yesterday. A byte in .NET represents a unsigned byte (0 - 255) automatically but a byte in Java is a signed byte(-128 - 127) and no there is no way to get an unsigned byte. I never really came across this problem till I was running some encryption algorithms on both. I need to encrypt a string in .NET and decrypt it on Java. For this I was converting the byte array into a hex string and asking users to enter it. However, because of the difference in interpretation of bytes I am running into problems.
NOTE: There is a signed byte in .NET available called ssbyte. I am not sure how an encryption algorithm can stuff it's data into it thgh. Sad! Sad! Sad!
CORRECTION: Okay so I had a brain-dead day and worte this out. It does not really matter how the two languages interpret the bits as long as the bits are the same going in to the encryption/decryption libraries.I am keeping this here to remind myself how stupid I can be.

.net byte => 0 ~ 255
java byte => -128 ~ 127

.net byte - 128 = java byte

출처 : http://geekswithblogs.net/rishi/archive/2006/01/27/67310.aspx


Posted by 파이팅야
,

검색엔진 연산어...

기타 2008. 3. 16. 12:59

연산어 - AND(&), OR(|), NOT(-,!), NEAR, WITHIN

네이버, 다음, 엠파스등은 현재 지원하지 않고 있다.

구글은 현재 다양하게 지원하고, 추가적인 연산어들도 있다.
1. ["홍길동 만세"] ""를 붙이면 붙어진 문자로 검색됨. ""가 없으면 [홍길동 AND 만세]임
2. [홍길동 -만세]는 [홍길동]검색안에서 [만세]문구 제거
3. [전자상거래 site:go.kr] go.kr도메인안에서 [전자상거래] 검색함
4. 영문일 경우 [~food]하면 food과 비슷한 [cooking, recipe]등도 검색됨
5. [전자상거래 filetype:ppt] ppt파일형식으로 검색
6. [엑셀 OR Excel] OR검색
7. [물가지수 2000..2007] 2000, 2001, 2002 ... 2007년 까지 모두 검색함
8. [1+2+3] 6 값 반환됨
9. [define:love] 사전기능
10. [inurl:report site:re.kr]re.kr도메인이고 report가 들어가는 URL을 검색함




Posted by 파이팅야
,