Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old May 8th, 2008, 05:54 AM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
CRC32 implementation needed

Hello
how to implement a crc32 algorithm, so to verify that a message was correctly sent to a destination?
ex: 10010101011
and output being: Yes, correct ot No, wrong
it's smth with ploynoms, but how to implement?
thanks

Reply With Quote
  #2  
Old May 22nd, 2008, 07:24 AM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by Talkabout
Hello
how to implement a crc32 algorithm, so to verify that a message was correctly sent to a destination?
ex: 10010101011
and output being: Yes, correct ot No, wrong
it's smth with ploynoms, but how to implement?
thanks

so no one can help me?
i need an algorithm to check if a message was correctly sent to destination. input: a binary string, and a polynom.
how can i implement this?

Reply With Quote
  #3  
Old May 22nd, 2008, 10:37 AM
IamPatrick IamPatrick is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 130 IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 22 h 14 m 57 sec
Reputation Power: 3
take the code from one of the thousands of open source implementations available on the web

Better yet your library (MFC, whatever) will almost definetely include an implementation

Last edited by IamPatrick : May 22nd, 2008 at 11:14 AM.

Reply With Quote
  #4  
Old May 23rd, 2008, 11:24 AM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by IamPatrick
take the code from one of the thousands of open source implementations available on the web

Better yet your library (MFC, whatever) will almost definetely include an implementation

but i did not see a good implementation, so one of which input is a binary string, and a polynom, and with some operations, the implementation should retrieve an error message or not.
can you give me an good example of that implementation?
Thanks

Reply With Quote
  #5  
Old May 23rd, 2008, 12:57 PM
AstroTux AstroTux is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 109 AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 49 m 20 sec
Reputation Power: 10
???

You might want to take a look here then, if you want to code it yourself.

http://en.wikipedia.org/wiki/Cyclic_redundancy_check

Best regards,
AstroTux.

Reply With Quote
  #6  
Old May 23rd, 2008, 01:02 PM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by AstroTux
???

You might want to take a look here then, if you want to code it yourself.


Best regards,
AstroTux.

ok, i read it, but i did not find a crc-9 algorithm for example(implementation). there are so complicated, i need one more easier, where cand i found it?
Thanks

Reply With Quote
  #7  
Old May 23rd, 2008, 01:20 PM
AstroTux AstroTux is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 109 AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 49 m 20 sec
Reputation Power: 10
Hi,

Maybe this will help? http://www.ptb.de/de/org/1/11/112/infos/crc16.htm

Google is a great tool.

Best regards,
AstroTux.

Reply With Quote
  #8  
Old May 23rd, 2008, 01:30 PM
IamPatrick IamPatrick is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 130 IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 22 h 14 m 57 sec
Reputation Power: 3
What operating system are you using? Are you using a set of libraries like .net or MFC?

For cross platform you could try:
http://www.boost.org/doc/libs/1_35_0/libs/crc/index.html

By the way, pretty much whatever libraries you use will give you a function that takes a ptr and a length (or an object which encapsulates that) and returns a crc; you'll have to write the function that takes a message and returns true or false.

And if easy is what your after take a look at LRC instead.

Reply With Quote
  #9  
Old May 23rd, 2008, 01:56 PM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by AstroTux
Hi,

Maybe this will help?

Google is a great tool.

Best regards,
AstroTux.

in that code where can i introduce from keyboard the binary string? and what is the verification result?

Reply With Quote
  #10  
Old May 23rd, 2008, 01:57 PM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by IamPatrick
What operating system are you using? Are you using a set of libraries like .net or MFC?

For cross platform you could try: //link

By the way, pretty much whatever libraries you use will give you a function that takes a ptr and a length (or an object which encapsulates that) and returns a crc; you'll have to write the function that takes a message and returns true or false.

And if easy is what your after take a look at LRC instead.

i heard that in C# there are classes which operate with CRC.
And in Java too, CRC32 class. but i don't know how to implement

Reply With Quote
  #11  
Old May 23rd, 2008, 04:06 PM
AstroTux AstroTux is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 109 AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level)AstroTux User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 18 h 49 m 20 sec
Reputation Power: 10
Hi,

Have you tried Google (or any search engine, for that matter)?

http://www.vbaccelerator.com/home/net/code/Libraries/CRC32/article.asp

Best regards,
AstroTux.
Comments on this post
IamPatrick agrees!

Reply With Quote
  #12  
Old May 23rd, 2008, 05:16 PM
IamPatrick IamPatrick is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 130 IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level)IamPatrick User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 22 h 14 m 57 sec
Reputation Power: 3
Is your problem that you don't know how to write software. If so choose a language, check out one of the online tutorials, make a first attempt at implementing crc checking and then start posting specific questions about the compiler errors you are receving on the devshed forum for that language...

Reply With Quote
  #13  
Old May 24th, 2008, 01:48 AM
Talkabout Talkabout is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Talkabout User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 56 sec
Reputation Power: 0
Quote:
Originally Posted by IamPatrick
Is your problem that you don't know how to write software. If so choose a language, check out one of the online tutorials, make a first attempt at implementing crc checking and then start posting specific questions about the compiler errors you are receving on the devshed forum for that language...

Code:
import java.util.zip.CRC32;
import java.io.*;
import java.util.*;
import openwfe.org.*;
public class crc32 {

public static final String initvalue = "37a52d19"; // hex string

public static void main (String args[]) {

String inputstring = "";
String checkstring = "";
String resultstring = "";

byte[] crcinput ;
byte[] initvalarr;

long result = 0;

InputHelper inp = new InputHelper();
System.out.println(" ****** CRC program ****** ");
System.out.println();
inputstring = inp.getUserInput(" Please enter a string to be checked: ");
checkstring = inputstring.substring(0,11);

crcinput = checkstring.getBytes();
initvalarr = initvalue.getBytes();
leng = checkstring.length(); 


// Compute CRC checksum.

CRC32 crc32 = new CRC32();
crc32.reset();

// Update initial value first.

crc32.update(initvalarr,0,initvalarr.length); 
crc32.update(crcinput,0,crcinput.length);

result = crc32.getValue();
resultstring = Long.toHexString(result);

System.out.println(" Validation result: " + resultstring); 
}
}

here is my first attempt to create a CRC32 application in Java.
but i have an error at InputHelper (cannot be resolved). i have the jar needed (openwfe), i added it to my project, but i cannot import openwfe.org.input.InputHelper
can anyone help me?
Thanks

Reply With Quote
  #14  
Old May 24th, 2008, 02:10 PM
B-Con's Avatar
B-Con B-Con is offline
Crypto-Con
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Apr 2004
Location: UC Davis
Posts: 6,633 B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level)B-Con User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 5 Days 16 h 3 m 52 sec
Reputation Power: 762
Hey, it looks like you're more struggling with implementation than with a Cryptogrpahic concept. You'll probably get more help in the Java forum.

Moved from Security to Java.
__________________
- "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.
- Why know the ordinary when you can understand the extraordinary?


- Sponsor my caffeine addiction! (36.70 USD recieved so far -- Latest donor: Mark Foxvog
)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Help with a crc32 implementation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump