|
So are you expecting us to guess what kind of help?
Use the best guess
|
|
|
|
|
Uhm, you probably should start with this[^]
|
|
|
|
|
What kind of animation you need.
Regards
Shubhashish
|
|
|
|
|
Hello,
When i am encrypting a string (One way hashed) using SHA algorithm, the output differs from two different platforms.
When done in windows, an extra CR (CR LF) character is appearing but when done in linux box only LF character is appearing in between the output encrypted value.
FYI - CR (enter) LF(Space)
This leading me with issues in further process of application.
Kindly help for the same
Gowthami
|
|
|
|
|
This has nothing to do with encryption. The CR LF sequence is set in Windows wherever the output string of a printf() format contains the \n control. In linux (and UNIX) it is replaced with a single LF .
Use the best guess
|
|
|
|
|
No it is not about the last character of string.
see for example if i do one way hash for '1234567890127866'
have a look on the outputs
Windows:
+zWcE7pR4k97ysyi54WS4G6J1Qjfp/tXllE23mMLCFBrIONMlrXyMw9aF1UCFKCFjbcz0Yzge78u(THIS IS THE PLACE WHERE I M GETTING CR LF)Usye+/4Ulw==
Linux:
+zWcE7pR4k97ysyi54WS4G6J1Qjfp/tXllE23mMLCFBrIONMlrXyMw9aF1UCFKCFjbcz0Yzge78u(THIS IS THE PLACE WHERE I M GETTING ONLY LF)Usye+/4Ulw==
which means the whole characters represents single string
Regards
Gowthami
|
|
|
|
|
I have just tried the same test and get a completely different result ([B@1748ba4 ), so I can only assume that there is some more information that you have not given us.
Use the best guess
|
|
|
|
|
meaning?? have you tried to encrypt the string in both windows and linux??
md = MessageDigest.getInstance("SHA-512");
md.update(plaintext.getBytes("UTF-8"));
byte raw[] = md.digest();
String hash = (new BASE64Encoder()).encode(raw);
return hash;
This is what I have used to encrypt
|
|
|
|
|
saigowthami wrote: meaning?? Meaning that all you showed us was the source data and the resulting hash value, we had no idea what code you had used.
Use the best guess
|
|
|
|
|
Ya i have posted my code in my previous reply itself
|
|
|
|
|
I cannot find BASE64Encoder so cannot try recreating your problem. However, as Bernhard explained in this response[^], these extra line terminators are added when you convert the data to a string. Keep it as a byte[] and see if you still have the problem.
Use the best guess
|
|
|
|
|
|
ok but my database is in linux machine, where the strings encrypted and saved to database,
while i m running the same encryption util in linux the output is not matching with the database one.
Meanwhile both places the code is same to encrypt the string.
|
|
|
|
|
Look:
- before you store the value in the database, remove all newlines.
- before you compare a value with a value from the db, remove all newlines.
That works.
Of course, you have to update your databse in case that you have some entries there already.
|
|
|
|
|
Hello,
I am trying to code an application, like sync operation between two machines to transfer the files and folders through internet. Is it possible to use ftp or any other in java and write the application?
Regards
Gowthami
|
|
|
|
|
It's definitely possible. You can use FTP server on one machine and use a java program to synchronize a local folder with remote folder on FTP server. The FTP Server must be accessible from internet.
Other way is to write your own socket server implementation and use it for synchronization. Unlike the first implementation, this will allow you to initiate synchronization from either machine. With first it will be always from the machine on which java program is running.
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
ya i used the socket programming only with two applications, client and server and transferred successfully... Thank you for the reply!!!
|
|
|
|
|
Hi Gowthami,
I am writing the java application for encryption/compression which will be integerated in spring batch application to transfer large files.once it is done i will upload the source code here.
|
|
|
|
|
|
Ho All,
I'm creating a TCP server with which I'll receive few strings.
First a file path
Second a message
Third another message
My code is:
String str;
while ((str = rd.readLine()) != null) {
System.out.println(str);
String file = str.toString();
.
.
.
.
.
while(something)
{
while(something new)
{
if(str.equalsignorecase("Google"))
{
System.out.print("My Yahoo");
}
else if(str.equalsignorecase("yahoo"))
{
System.out.print(My Google);
}
}
}
}
rd.close();
socket.close();
In this program, I'm able to access the first string but not getting the second string on
server.
How can I use
String str
multiple times sent by a TCP client?
Thanks!
|
|
|
|
|
There is some information missing here. Also what is this line supposed to do:
String file = str.toString();
str is already a string. Your if statements also seem the wrong way round.
You could do basic testing on this just by receiving each message and displaying it, which would show if it is working correctly.
Use the best guess
|
|
|
|
|
This is working properly first time when I get a message from client.
But when I get the next message from client it is being used as the previous one.
I want to use second message sent from client.
|
|
|
|
|
Then it's not working properly; but you have not given us enough information to help figure it out. There are plenty of working samples of sockets in Java to be found on the internet; maybe you should check your code against some of them.
Use the best guess
|
|
|
|
|
Indian Coder1989 wrote: I'm creating a TCP server with which I'll receive few strings.
Then stop doing that.
TCP should be sending a message. That message contains data.
Your design would consist of creating a layer that does the following and ONLY the following.
-- Send
- Take in input object (path, message1, message2)
- Put that data into a message. As an EXAMPLE the pseudo representation is as follows
<header>: MSG
<string cnt>: 3
<string1 len>: 15
<string1 data>: /mypath/stuff01
<string2 len>: 11
<string2 data>: Message One
<string3 len>: 13
<string3 data>: Other Message
- Send the message
--Receive
- Wait for message
- Parse message into a list of strings. (3 in the above example)
- Put messages into expected output item (path, message1, messate2)
The above is a bit generalized. It could be less generalized or more so.
The important parts however are that
1. There is ONE message regardless of the data items (because presumably the data items are really part of one collection.)
2. The message defines the length (specifically the length of three strings and the total string count.)
3. The message is part of the communications API, it is not part of the rest of the application. The rest of the application does not know and does not care that the 'message' exists.
4. The rest of the application uses the communications API. It does know and does not care that TCP is being used.
|
|
|
|
|
Its Done using Switch statements.
|
|
|
|