Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [checksum]

A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and comparing it with the stored one.

Filter by
Sorted by
Tagged with
1
vote
2answers
98 views

Validation of credit card number

I have written the code for credit card number validation and it works correctly but I feel that the code could be reduce to fewer lines. ...
3
votes
1answer
96 views

Introduction to Haskell: Validating credit card numbers

I have implemented the introductory challenge of University of Pennsylvania's CIS 194: Introduction to Haskell (Spring 2013) course. I have added the most important information of the problem ...
10
votes
1answer
327 views

Credit card validation in C

I am relatively new to C programming and I am currently working through the CS50 EDX course. The problem I have solved below is for week 1 (credit). Any suggestions on how to improve this code to ...
3
votes
2answers
90 views

Optimizing Luhn check digit algorithm

The internet as a whole and Code Review in special already provide a decent amount of implementations of the Luhn check digit algorithm. They often follow a relatively "naive" strategy, in that they ...
10
votes
2answers
274 views

Verhoeff check digit algorithm

A recent question on credit card validation here on Code Review, led me down a dark rabbit hole of check digit algorithms. I took a stop at the Verhoeff algorithm and tried to implement it myself. ...
7
votes
2answers
299 views

Credit card validator using Luhn Algorithm

I'm looking for feedback or tips to maybe make my code more readable or faster or just general tips to help get myself started with app making with Python. ...
7
votes
1answer
74 views

Finding duplicate files on a disk using MD5

I started learning Python a month ago (used to write programs in Delphi before). Can you please take a look at my code and give me some tips what is good and what is bad in it? The aim is to find ...
3
votes
1answer
53 views

checksum hash verification functions for bash scripts

just a little script, or a bit of a template of one that I used to submit an assignment. I believe it all works fine, I just wanted to give it to other people, and get some feedback on it; maybe make ...
4
votes
1answer
237 views

Swedish 'Personnummer' validator

I have a small C# program that validates Swedish social security numbers ('Personnummer'). I chose to use Regex as there are many different ways it can be input. ...
12
votes
3answers
1k views

Implementation of Luhn credit card algorithm

I've implemented Luhn's algorithm for checking credit card numbers. My code works, but I wanted to learn about a more efficient and more Pythonic way of doing this. ...
1
vote
1answer
174 views

Credit card validator in Python 3.7.1

I am doing some projects so I can teach myself programming. The one that I finished states: "Credit Card Validator - Takes in a credit card number from a common credit card vendor and validates it to ...
3
votes
3answers
96 views

CRC without knowing the data type or size

I wrote a function to calculate an 8-bit CRC/checksum for unknown data types. The only restriction is the data type must be at most 4bytes/32bits. ...
1
vote
2answers
1k views

Luhn Algorithm “modulus 10” checksum

I wanted to challenge myself in a new language that I am learning (C#) by doing a simple exercise: check if a "modulus 10" Luhn number is valid or not. In this case the common application if verifying ...
4
votes
3answers
1k views

Calculating a Luhn Check Digit

I was able to find all kinds of examples that demonstrate how to validate a Luhn Checksum but very few that actually generated the check digit. Here is my attempt in base 10, based on the validation ...
4
votes
1answer
59 views

Making a Zsync file archive with checksums

I'm learning go by doing it. I tried to port the Java's ZsyncMake implementation into Golang. I also employ the Go's concurrency API with goroutine and channel. I have some experience in Java, but ...
7
votes
2answers
804 views

Determining whether a provided credit card number is valid according to Luhn’s algorithm

I have been working on credit problem for edx CS50 and got it working as intended. an issue I find with it is the way I have to reinitialise the cardNumber variable ...
6
votes
1answer
305 views

Simple Credit card validation

I'm a beginner to Haskell (intermediate in web-dev stuff and JavaScript) and I'm not really sure what I could do better for Homework 1 of CIS194 that I'm taking online. The problem statement is as ...
6
votes
2answers
1k views

Luhn checksum in Python

I've implemented Luhn checksum in Python version 3. I want your comments and opinion about my code. I know it's embarrassing code and that it doesn't follow python best practices but it works!. The <...
4
votes
1answer
301 views

Implementing a 7-3-1 check digit

I need to implement a method that adds a "7-3-1" check digit to my id. The "7-3-1" method works as following: Weights 7, 3, 1 are assigned to the original number from right to left. So if the ...
3
votes
2answers
216 views

Validating IBAN in Ruby

Looking for tips on how to improve my code and areas that I can better follow Object Orientated principles. Is this class structure ok? How is the code overall? The problem: There are two IBAN ...
2
votes
1answer
877 views

Generate and validate EAN-13 barcodes

I developed a console app to generate and validate EAN-13 barcodes. I'm planning to develop a Windows Forms counterpart to render them as images using a barcode font. I may test the console interface ...
7
votes
1answer
285 views

Binary test file generator with checksum

In reading this question, it occurred to me that it would be helpful to create test files according to the file format specification. To recap, the file format is as follows: File format Note that ...
3
votes
1answer
679 views

Parse data file and verify checksum

Here's my assignment: Write a program that takes a filename as its only command line argument and prints the results to std::out formatted as follows: ...
3
votes
1answer
753 views

Credit card validator code in Python

I wrote a Python code that is validating Credit Card Numbers. Some of the advanced programmers told me my whole code is messy. How can I make my code cleaner? ...
2
votes
2answers
167 views

Checksum computation in x86_64

This is an implementation of the TCP/IP checksum computation as described in https://tools.ietf.org/html/rfc1071. The function is writen in DynASM, an assembler preprocessor that is part of LuaJIT. I ...
1
vote
1answer
198 views

Ontario Health Card mod 10 validation

An example of the business rules are here. Does this code implement those rules correctly? Note that you will have to derive the rules from the example. ...
3
votes
0answers
631 views

Python code to calculate STM CRC32

I have code to calculate STM CRC32 in python. It works well but I'm shocked from time when I see how much it takes. Namely calculating for 5120 bytes takes about 20ms (or even more)! Now I'm thinking ...
0
votes
2answers
69 views

Refactored 2 functions into 1 - Verify UPC/EAN13 barcode

I refactored 2 seperate functions that I found here into a single function: ...
7
votes
1answer
163 views

UPenn CIS194: Credit Card Validation (Homework 1 Part 1 Tests)

I am working through the UPenn CIS194 lectures and homework assignments in an effort to learn more about Haskell. The first part of the first homework is focused on validating credit card numbers. ...
8
votes
2answers
584 views

8088 assembly checksum implementation

The following 8088/8086 assembly program tests the modular-sum checksum of a block of data. I suspect it could be tighter; can anyone do it in fewer bytes? ...
2
votes
1answer
130 views

Arduino Create and send data to Serial Port (Software Serial function)

I have this code written and functioning that will write out the chars in cmd to a serial port for an input of two int values. As the majority of the byte values ...
7
votes
1answer
2k views

Credit card validation - Python 3.4

Just completed a piece of code - a credit card validation program in python - as a little side project. Having no experience with classes in the past, I decided to employ classes in this project. I ...
3
votes
2answers
536 views

Assembly: Sum up the single bytes of a 32bit-register to a checksum

Exercise description: "Write a program that takes a double word (4 bytes) as an argument, and then adds all the 4 bytes. It returns the sum as output. Note that all the bytes are considered to be of ...
1
vote
1answer
2k views

JavaScript function for computing the checksum of a given number

I've got to made a function which returns the checksum of an given integer. Source code of my implementation so far: ...
13
votes
2answers
4k views

Check the validity of a South African ID number using the Luhn Algorithm

...
2
votes
1answer
3k views

16-bit Checksum function in C

I was playing with TCP/IP, and came across this 16 bit checksum function: ...
2
votes
1answer
2k views

Credit card validator in Python

I have began taking the CS50 course on EDX the past couple of days, and one of the tasks to accomplish was to write a credit card validator in C. I wrote it in C, and then I thought that I could go ...
2
votes
1answer
127 views

Convert ISBN10 to ISBN13

Looking to confirm that I am doing this in the most efficient way. ...
7
votes
2answers
4k views

Google FooBar XOR Checksum Challenge

Google FooBar came up a few days ago and I took it as a challenge to learn python quickly while having fun. However, I ran into one challenge today that has left me stumped, I've come up with a ...
3
votes
0answers
2k views

Calculating CRC using arbitrary polynomials

This is my implementation of calculating CRCs which supports arbitrary polynomials specified in different representations (according to the explanations given here and here). My concerns are: I don'...
1
vote
2answers
1k views

An algorithm to calculate the check digit for 18-digit SSCC GS1 codes

I'm calculating the GS1 SSCC codes that are 18-digit barcodes. The 18th digit is a check digit which is used to validate the rest of that code and check that it is correct. the check digit is a number ...
9
votes
1answer
277 views

Haskell code to verify credit number

I am new to Haskell, and wrote a script to verify credit number. I did some tests, the script worked, but can it be improved further? ...
7
votes
1answer
2k views

Check Digit Calculator & GTIN-8 Validator

This program calculates the 7th digit of a GTIN-8 barcode and calculates the validity of an 8 digit GTIN-8 barcode. Could I simplify my code any further? ...
4
votes
4answers
739 views

GTIN validation

I have a school assignment to allow a user to enter a GTIN and then validate that it is correct. I have finished the code, but my teacher has told me I will get more marks if I can make it more ...
4
votes
1answer
140 views

Round Two: File hash sum generator in Python

This is a follow-up review request to the first one for this same utility/file/script. The first review can be found here: Cross-platform file hash sum generator in Python I'm back with the modified ...
5
votes
1answer
523 views

Credit card / IMEI check digit in Kotlin

I recently had the need to implement Luhn's Algorithm in a Java/Kotlin application. I needed a function that would add the check digit to the string of a number like a credit card or IMEI. It could be ...
5
votes
2answers
486 views

Cross-platform file hash sum generator in Python

I'm back for more community punishment review of my own scripts and code! This time, I'm looking for general code review of my approach to a Python way of getting one or more hash sums for a provided ...
7
votes
1answer
295 views

Implementing checksum add without carry in C

I need to write a function in C which performs a checksum using the rule "add without carry". As I understand it, the "add without carry" concept is equivalent to the bitxor operator and given that ...
12
votes
2answers
2k views

Python Hash-Cracker

This is my first actual python tool I've written and I'm certainly happy with the way it works, but I'm sure there's better ways to do things in the code. Any ideas on how to speed it up would also be ...
1
vote
4answers
388 views

powershell md5 compare too slow

I'm trying to compare several files using md5 hash with powershell 2.0. The code works, the problem is that it's to slow. It takes longer in step 3. It's about 500 files to compare. Can you see a way ...