|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Quote:
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? |
|
#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. |
|
#4
|
|||
|
|||
|
Quote:
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 |
|
#5
|
|||
|
|||
|
???
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. |
|
#6
|
|||
|
|||
|
Quote:
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 |
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
Quote:
in that code where can i introduce from keyboard the binary string? and what is the verification result? |
|
#10
|
|||
|
|||
|
Quote:
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 |
|
#11
|
|||
|
|||
|
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. |
|
#12
|
|||
|
|||
|
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...
|
|
#13
|
|||
|
|||
|
Quote:
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 |
|
#14
|
||||
|
||||
|
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) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Help with a crc32 implementation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|