0

in C#:

encryptionKey="Wb2bLNGXABcl4Lz........AxqA5Xhsoqi7w52RKA=";

var key = Convert.FromBase64String(encryptionKey);

key value={89,189,155,44,209,151,0,23,37,224,188,250,186,104,35,70,250,81,212,12,106,3,149,225,178,138,162,239,14,118,68,160}

in java:

byte[] key= Base64.decodeBase64(encryptionKey);

key={89,-67,-101,44,-47,-105,0,23,37,-32,-68,-6,-70,104,-21,70,-6,81,-44,12,106,3,-107,-31,-78,-118,-94,-17,14,118,68,-96};

key value is different in Java and C#. how to get same value in Java?

2
  • i am looking for relevant code in java for same output. Commented May 14, 2014 at 6:23
  • They are they same output. Java's displaying signed bytes, C# isn't. Commented May 14, 2014 at 7:00

1 Answer 1

0

It's the same. In the first case bytes are unsigned and Java bytes are signed. What we see in array is different interpretation of the same value, eg 189 and -67 = 0xBD

byte b = (byte) 189;

now b = -67

Sign up to request clarification or add additional context in comments.

1 Comment

thanks Evgeniv Dorofeev

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.