QR code not being processed with hard return consistently across devices - qr-code

Processing a string to genrate a qr code with the barby gem
Barby::QrCode:0x00007f903399aed8 #data="8076809574693\r\n8076809574693\r\n8076809574693\r\n4017100364013\r\n4017100364013\r\n3017760002707\r\n8076809517706\r\n8013355999488\r\n", #level=:q, #size=nil
is generating a QR code as a PNG file which is read correctly by off-the-shelf android apps. However, when run against a Honeywell 3320 hand-held scanner, it is being recognized as simply a string of digits
what other approaches could be taken to generate the hard return?

Related

Migrating AES encryption libraries

The goal
We’ve been using EasyByte’s Cryptocx library to encrypt documents using AES256. The library is 32-bit and is preventing us from building a 64-bit version of our application. EasyByte went out of business and there’s no 64-bit version, source code or support for the library.
We’d like to use Chilkat’s 64-bit ActiveX component to be able to decrypt the documents directly. Migrating all our customer’s documents by decrypting and re-encrypting them would be a huge cost.
I’m trying to infer the mode of operation (ECB, CBC…) so that I can send Chilkat the right parameters. The Cryptocx method we’re using only accepts the source and destination files and a string password:
http://www.easybyte.com/support/cryptocx/aesfileencrypt.html
What I tried
I don’t have a strong background in cryptography, but this is what I tried.
A 64-byte input file (4 blocks in AES) filled with As (hex 41). A 32-character string for the password, also filled with As. By calling the previous method to encrypt several times (same file, same password) and using a hex editor I can observe that files have five 16-byte blocks in the encrypted file.
The first four blocks are identical and the fifth differs. Is this the initialization vector being stored in the file? If it is and it’s different in all the files, shouldn’t the first four blocks also be different?
Assuming it was CBC (since the Wikipedia article claims it’s the most used) I tried removing the last 16 bytes from the file (using a hex editor) and using them as the IV to decrypt the file.
But I didn’t get the expected clear text.
Some code
This is the code I tried, in VB.net:
Dim chilkat As ChilkatCrypt2 = New ChilkatCrypt2
chilkat.UnlockComponent(licenseKey)
chilkat.CryptAlgorithm = "aes"
chilkat.KeyLength = 256
chilkat.CipherMode = "cbc"
chilkat.SetEncodedKey("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "ascii")
chilkat.SetEncodedIV("36cd36dae64316e80d50871e3b26b4bb", "hex")
Dim result = chilkat.CkDecryptFile(pathToEncryptedFile, pathToDecryptedFile)
If result = 0 Then
Console.WriteLine(chilkat.LastErrorText)
Console.ReadLine()
End If
I would appreciate some direction. Can the right parameters even be inferred from the output without knowing the implementation details?
Thanks a lot.

Extract contacts and messages from a Nokia 105 full dump (.bin) file

Have a problem where I had to read the complete firmware (using an eeprom reader) from a hardware disabled (beyond repair) Nokia 105 (RM-908) in order to try and extract SMSes and the contacts. Using a hex editor I can see the all the data, however,I cannot manage to find out the complete information. For instance the date and receiver of the messages or the user associated with the contact numbers. The only idea I believe that can be done is to extract the personal user area PMM from the bin, get another set with the same version of this disabled device, build up an image, flash the resulting image using an appropriate flasher in the working device and read the content off this device. While I am unsure if this will work (theoretically might work), would like to try to avoid this procedure as it is very time consuming and maybe get to the target data directly via hex editing or any other application.
thanks for any help

Output words in speaker with arduino

I want to generate voice in arduino using code. I can generate simple tones and music in arduino, but I need to output words like right, left, etc in arduino speaker. I found some methods using wav files but it requires external memory card reader. Is there a method to generate using only arduino and speaker?
Typical recorded sound (such as wav files) requires much larger amounts of memory than is a available on-chip on an Arduino.
It is possible to use an encoding and data rate that minimises the memory requirement - at the expense of audio quality. For example generally acceptable quality speech-band audio can be obtained using non-linear (companded) 8-bit PCM at 3KHz sample rate, which if differentially decoded to 4 bit samples (so that each sample is not the PCM code, but the difference in level from the previous sample), then you can get about 1 second of audio in 1.5Kbytes. You would have to do some off-line processing of the original audio to encode it in this manner before storing the resulting data in the Arduino flash memory. You will also have to implement the necessary decode and linearisation.
Another possibility is to use synthesised rather then recorded speech. This technique uses recorded phonemes (components of speech) rather than whole words, and you then build words from these components. The results are generally somewhat robotic and unnatural (modern speech synthesis can in fact be very convincing, but not with the resources available on an Arduino - think 1980's Speak-and-Spell).
Although it can be rather efficient, phoneme speech synthesis requires different phoneme sets for different natural languages. It is possible perhaps for a limited vocabulary perhaps to only encode the subset of phonemes actually used.
You can hear a recording of the kind of speech that can be generated by a simple phoneme speech generator at http://nsd.dyndns.org/speech/. This page discusses a 1980's GI-SP0256 speech chip driven by an Arduino rather than speech generated by the Arduino, but it gives you an idea of what might be achieved - the GI-SP0256 managed with just 2Kb ROM - the Arduino could probably implement something similar directly. The difficulty perhaps is in obtaining the necessary phoneme set. You could possibly record your own and encode them as above. Each word or phrase would then simply be a list of phonemes and delays to be output.
The eSpeak project might be a good place to start - it is probably too large for Arduino, and the whole text to speech translation unnecessary, but it converts text to phonemes, so you could do that part off-line (on a PC), then load the phonemes and the replay code to the Arduino. It may still be too large of course.

How to verify that two (version 10) QR codes have the same message?

I'm making an Apple Passbook Pass for a 3rd party, and the QR code that I need to show on the pass is actually made from another QR code by decoding it, because Apple only lets you specify the message for the QR code and not the actual picture of it.
For some reason, the Passbook-generated QR code is different from the original 3rd-party QR code, even though they appear to have the same message upon decoding. Both of them are Version 10 QR codes.
I've already figured out that this is due to different levels of error recovery.
How can I verify that the codes contain the exact same information (same encoding and such)?
You should decode them and compare the strings. There aren't "invisible" characters -- non-printing, maybe, but they would still appear in the string.
Note that encoding can vary by choice of mask pattern and ECI segments.

Using multiple QR codes to encode a binary image

I'm increasingly looking at using QR codes to transmit binary information, such as images, since it seems whenever I demo my app, it's happening in situations where the WiFi or 3G/4G just doesn't work.
I'm wondering if it's possible to split a binary file up into multiple parts to be encoded by a series of QR codes?
Would this be as simple as splitting up a text file, or would some sort of complex data coherency check be required?
Yes, you could convert any arbitrary file into a series of QR codes,
something like Books2Barcodes.
The standard way of encoding data too big to fit in one QR code is with the "Structured Append Feature" of the QR code standard.
Alas, I hear that most QR encoders or decoders -- such as zxing -- currently do not (yet) support generating or reading such a series of barcodes that use the structured append feature.
QR codes already have a pretty strong internal error correction.
If you are lucky, perhaps splitting up your file with the "split" utility
into pieces small enough to fit into a easily-readable QR code,
then later scanning them in (hopefully) the right order and using "cat" to re-assemble them,
might be adequate for your application.
You surely can store a lot of data in a QR code; it can store 2953 bytes of data, which is nearly twice the size of a standard TCP/IP packet originated on an Ethernet network, so it's pretty powerful.
You will need to define some header for each QR code that describes its position in the stream required to rebuild the data. It'll be something like filename chunk 12 of 96, though encoded in something better than plain text. (Eight bytes for filename, one byte each for chunk number and total number of chunks -- a maximum of 256 QR codes, one simple ten-byte answer, still leaving 2943 bytes per code.)
You will probably also want to use some form of forward error correction such as erasure codes to encode sufficient redundant data to allow for mis-reads of either individual QR codes or entire missing QR codes to be transparently handled well. While you may be able to take an existing library, such as for Reed-Solomon codes to provide the ability to fix mis-reads within a QR code, handling missing QR codes entirely may take significantly more effort on your part.
Using erasure codes will of course reduce the amount of data you can transmit -- instead of all 753,408 bytes (256 * 2943), you will only have 512k or 384k or even less available to your final images -- depending upon what code rate you choose.
I think it is theoretically possible and as simple as splitting up text file. However, you probably need to design some kind of header to know that the data is multi-part and to make sure different parts can be merged together correctly regardless of the order of scanning.
I am assuming that the QR reader library returns raw binary data, and you will you the job of converting it to whatever form you want.
If you want automated creation and transmission, see
gre/qrloop: Encode a big binary blob to a loop of QR codes
maxg0/displaysocket.js: DisplaySocket.js - a JavaScript library for sending data from one device to another via QR ocdes using only a display and a camera
Note - I haven't used either.
See also: How can I publish data from a private network without adding a bidirectional link to another network - Security StackExchange

Resources