Visual C++ :: Decoding RFID Data Hexadecimal Math
Feb 2, 2015
I currently am stuck at getting the needed outcome data from my RFID card. I got it decoded but now I need to do a few more things in order to get the final card number off the back of the card.
The cryptic value was E********B**0**E** (covered to protect card)
Decrypting it turned into 0000003048D1263B
Now I have 3 more steps to take in order to get to my wanted card number.
Step 1) Mask off the lower 20-bits (which should give me 0x1263B) I am unsure of how to go about doing that using C++.
Step 2) Divide by 2 to strip off the lower parity bit (which should be 0x931d). And again, I'm unsure of how to go about doing this in C++.
Step 3) Convert hexadecimal value to decimal value (which would equal my wanted card number). This should be easily done using C++ at this point - though hard to confirm that since I am on step 1).
Code:
const char* original = "0x931d";
unsigned long n = std::strtoul(original, nullptr, 16);
All of this looks to me like RegEX does to most people - complicated and not understanding why it does what it does but gives the correct output.
View 2 Replies
ADVERTISEMENT
Feb 2, 2015
I currently am stuck at getting the needed outcome data from my RFID card. I got it decoded but now I need to do a few more things in order to get the final card number off the back of the card.
The cryptic value was E********B**0**E** (covered to protect card)
Decrypting it turned into 0000003048D1263B
Now I have 3 more steps to take in order to get to my wanted card number.
Quote
Step 1) Mask off the lower 20-bits (which should give me 0x1263B) I am unsure of how to go about doing that using C++.
View 2 Replies
View Related
Mar 11, 2015
I was assigned to make a vigenere cipher using the function void vegenere(char* to_encrypt, char* key, char* encrypted) I got it to work for the encryption but i have to be able to decrypt the phrase too. I was assigned to write in a flag which indicated encryption or decryption. I tried to implement this but now it wont decrypt and i dont know why, all it does is put the same copy of decryption (which is really encrypted) multiple times until it crashes.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void decrypt(char *to_encrypt, char *key);
enum flag{encryption = 1, decryption = -1};
[Code] ....
Ok i found my dumb error of putting decrypt on an infinite loop which i fixed by putting it into the if statement after the encryption output. However now it says that the encrypted and decrypted outputs are identical without decrypting the ciphertext
View 5 Replies
View Related
Sep 9, 2014
I'm trying to write a program that takes input from the user (thats a char) and outputs it to the monitor in hex form.The program is meant to continuously take input from the user then output to the monitor in hex form until an EOF is detected this triggers the program to close.The following code does this except that I get a lower case 'a' at the end of each output.
example:
input from user: ABC
output to monitor: 41 42 43 a
#include <stdio.h>
int main(void) {
char myChar;
[Code]....
View 3 Replies
View Related
Dec 4, 2014
I'm new to C++ and involving encoding and decoding text from text files. When I enter a file in the program just stalls.
#include <iostream >
#include <iomanip>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
char getmenuselection (char m);
{Code] .....
View 3 Replies
View Related
Jan 6, 2013
I'm having some problems in receiving fileNames from Server to Client(C++) in Mac OS X. I send a serialized object , which has a char pointer with the fileName or sometimes a string object, when i receive it in the client, it seems to be having %F6 or %E9 ,etc . This issue don't arise in Windows OS though, even thought it's the same code. Is there anyway decoding these '%' characters back to their original form in Mac OS & Linux ..?
Fex characters i got into problems with : ǡ ȅ ȉ
It would be difficult to change the code in server, so if there's a way decoding the characters back to its original form, it would be easier.I'm using Boost Library for Serialization and i'm just looking for ways to decode %F6 back to ȅ in C++, like if some library is available ..?
View 1 Replies
View Related
Apr 10, 2013
I receive messages over a bus. Suppose there is a function to read the messages storing them into a struct defined as follows:
typedef struct
{
ULONG timestamp;
BYTE ID;
BYTE data_length;
BYTE data[8];
} MSG_FRAME;
Depending on the message ID different messages represent different values for one project.For example msg with ID 10 can include in the 8 bytes something like:
width: 6 bits
height: 6 bits
actpos: 12 bits
maxpos: 12 bits
minpos: 12 bits
range: 16 bits
total: 64 bits = 8 bytes
Printing the message is no big deal. But here comes the tricky part. I want to print out the specific information hidden in the 8 bytes. I can define the structures for every msg ID and compile the program with this "special" header file, but I want to do it during runtime of the program, loading the information regarding the msgs, because i can have different projects where the information for different msg IDs can differ.
I've a non-C file, where basically all the information is written. Lets stay frame named
GetStatus{
bit 0 - 7 width
bit 8 - 15 height
.
.
}
etc.
How to read it on runtime and decode the messages? On runtime I'm not able to create variables and structures anymore!
View 13 Replies
View Related
Oct 31, 2014
I am writing a porgram which includes encoding and decoding a message.Now I am doing the encoding part.
The goal is to encode a message using similar approach as Caesar Cipher. But instead of alphabets, I am going to use the entire ASCII code of total 128 codes to be the base.
And it is not a simple shifting, it is a rotation. This means if you want to shift 4 units from char <DEL>, it will come back to the first code in ASCII Code which is at dec 0 char <NUL> and starts the shifting again. It won't jump if the limit of ASCII Code is reached.
Here we've got 7 different malls' names and I am going to encode them with a shift n. I think n is free to set, so here I just set it as 5. This is also called the key.
I have written something and I think it should work, but after all it doesn't. And I don't get what is wrong.
Here is my program:
#include <iostream>
using namespace std;
const int NUMBER_OF_MALLS = 7;
const int MALL_NAME_LENGTH = 13;
const int NAME_SIZE = MALL_NAME_LENGTH + 1;
void encode(int key, char plain[], int length, char encoded[]) {
for (int i = 0; i < MALL_NAME_LENGTH; i++)
[code].....
Note that I am not going to use other libraries, just <iostream>.
View 13 Replies
View Related
Jan 11, 2014
I'm reading from a file the middle column of data (Volts) where my test file "AP.txt" is opened by my program. Here is a segment of the data:
time Volts dV
49552 -66.20183 -0.01556807
49553 -67.76025 -0.01556495
49554 -69.30704 -0.01533247
49555 -70.81799 -0.0148486
49556 -72.26774 -0.0141133
49557 -73.63226 -0.01315276
49558 -74.89141 -0.01201764
Since the calculation I performed gives me -71.77 Volts, I need to match this value to the time that this occurs closest to using my program, and output the time that this occurs at.
Here is my program so far:
int main()
{
std::ifstream inFile;
inFile.open("AP.txt");
ofstream results_file ("maxvaluewithinput.txt");
float TimeAtdVMax = 0;
float VoltsAtdVmax = 0;
[Code]...
If you're curious, this program isn't for homework. It's part of the independent learning on C++ I'm doing for a Master's Thesis; the program will eventually model the APD90 of a ventricular action potential.
View 10 Replies
View Related
Feb 6, 2014
I am wanting to be able to add as many different instances of data, while the user has not stated 'n', but then it only ever writes back to the screen the input for the last set of data. Where as I want to display back to the screen all the data that has been entered.
Code:
#include <iostream>
#include <string>
/*Function Declaration*/
void createItem();
void returnItem();
//Items structure
[code]...
View 6 Replies
View Related
Oct 7, 2014
I'm trying to print the full value (in hexadecimal) of a pointer.This is my best attempt so far:
Code:
char *text = "x10x11x12x13x14x15x16x17";printf("%x", &text);
And it obviously doesn't work, best I've gotten is a single byte, but I want the whole lot of bytes.
View 4 Replies
View Related
Jun 3, 2014
i m trying to write a code that would convert a each letter from a text to their decimal images . while i was able to write the part of entering the text , i cant do the converting part , i searched all day on the internet and found nothing.
View 3 Replies
View Related
Feb 21, 2013
I have an array:
Code: int array1[]={0,1,1,0}
I need to convert the entire array to Hexadecimal.
My first thoughts to the approach was to convert the array to a string then strcmp but i cant seem to find how to convert an array to a string either.
How to convert the array to hexadecimal directly? or, How to convert the array to a string to be strcmp'ed?
View 6 Replies
View Related
Apr 21, 2014
Write the function itob(n,s,b) that converts the integer n into a base b character representation in the string s . In particular, itob(n,s,16) formats n as a hexadecimal integer in s .
Note that it says the result is formatted into a hexadecimal integer in the string s. Here is the example provided:
Code:
void itob(int n, char s[], int b) {
static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i, sign;
if ( b < 2 || b > 36 ) {
fprintf(stderr, "EX3_5: Cannot support base %d
[Code] ....
Why does digits array hold the full alphabet when the maximum digit for a hex number is f?
View 1 Replies
View Related
Nov 20, 2013
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
[Code]...
1)What should be the best variable for adding two 6-digit hexadecimal,such as 0034AD,0057EA? I would like to use array of character but it seems hard to handle.
View 3 Replies
View Related
Jun 8, 2014
I have to write a code that converts a hexadecimal value to a decimal value.So far I have
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int num;
char g;
int rem;
int main(){
cout << " input num: "; cin >> num;
[code]....
I think i need to put the g and rem value into a string... which I'm not sure how to do since g will be a char value and rem will be a int value... and after I believe i need to then flip the numbers in the string.. oh it has to be in the format of 0000
View 5 Replies
View Related
Feb 25, 2015
I'm taking a university course and one of our first projects dealing with C is to write a hash table (with chaining as a collision solution) that will hash loads of hexadecimal values into the table. I'm just brain storming right now but how practical is it to hash the values by converting them to decimal and working with that value in another function to organize the values? I'm thinking this might take a lot of time and memory because our code will be tested with text files that could have a few lines of hexadecimal addresses or millions of them.
View 2 Replies
View Related
Feb 20, 2015
I am new at programming and I have some questions about converting decimal to hexadecimal WITHOUT using .net library. The problem is, that I don't know how to do vice versa. (if you type 1254, program returns 6,14,4. I want programm to return 4,14,6- this is almost hexadecimal number (14 is not converted to "E")). Also the task is, that program has to return value in string form.
static void Main(string[] args) {
int a = 0;
int result = 0;
int n=1000000;
int[] array = new int[n];
Console.WriteLine("Insert numbers");
a = int.Parse(Console.ReadLine());
[Code] ....
View 12 Replies
View Related
Aug 19, 2013
How to search in C or C++ a hexadecimal patterns within a binary file.
For example:
String1:
Code: 0x44 0x65 0x07
Then, once found, extract those 3 bytes and the next 11 bytes (14 bytes in total).
Finally, from those 14 bytes, print without spaces "bytes 1 to 6", "bytes 6 to 12", and byte "13 to 14".
Then I would like to print last 2 bytes (13 to 14) joined in decimal format.
The output without any conversion would be:
Code:
446507c90688 888000800005 0015
4465072ec918 059173495269 002C
44650700cc01 01811bc90b00 00AB
But the output converting to decimal the last 2 bytes would be:
Code:
446507c90688 888000800005 21
4465072ec918 059173495269 44
44650700cc01 01811bc90b00 171
The sample file is attached, and looks like this:
Code:
06 00 00 80 00 00 00 80 09 3c c9 06 88 88 80 00
80 00 44 65 07 c9 06 88 88 80 00 80 00 05 00 15
37 06 01 00 00 01 00 65 00 00 00 02 00 00 02 00
18 00 00 00 03 00 00 03 00 17 00 00 00 04 00 00
[Code] .....
View 8 Replies
View Related
Mar 10, 2013
I'm trying to convert 4 hex register into floating point value using IEEE 754 floating point format. My device will reply 4 register value. The problem is that it always reply for example 0x10 as 10 when i use getc() hence using char variable to store it is not ideal.
Code:
union {
char c[4];
float f;
} conv;
View 4 Replies
View Related
Oct 2, 2013
i need to code a function that converts an array of 64 bits into a hexadecimal value, the one is tested gives me correct value except for the last hexadecimal letter.
Code:
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <cstdlib>
#include <string>
typedef unsigned __int64 Ebyte;
#define length 64
[Code] .....
View 12 Replies
View Related
Jan 19, 2014
#include <stdio.h>
#include <stdlib.h>
int main(int argc, int * argv) {
char buffer[16];
FILE *fp;
unsigned long long test;
unsigned char key[16];
fp = fopen("D:key.txt","r");
[code].....
i searched for a code for reading bytes from a file and i found this one but when i run the program, it doesn't return the bytes written in the file, it returns another bytes / what is the problem?
View 3 Replies
View Related
Sep 22, 2014
How would one write 3^i without using .math? (i being numbers 0-9)
More specifically, this is what I have:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int x, n, answer1, first;
x = 3;
n = 10;
first = 1;
[Code]....
And this is what I want it to produce:
1 0 1.0
3 1 0.333333343
9 2 0.111111112
27 3 0.037037037
81 4 0.012345679
243 5 0.004115226
729 6 0.001371742
2187 7 0.000457247
6561 8 0.000152416
19683 9 0.000050805
I believe I am only having troubles with the first column,
View 10 Replies
View Related
Feb 8, 2013
I have a problem with entering math functions in my Bisection method algorithm program. I just don't know how can I make the function that I enter in my GUI app to go from the GUI to the loop and find the root.As far as I googled I only find codes that you need to pre-enter a function in the double/float.
For example:I have a function f(x) = x^3 - cos(x) - x - 3; and I want to enter that function trough the GUI i made in c++..So this is the main code.
#include "bisection.h"
#include "ui_bisection.h"
#include <QFile>
#include <QString>
#include <math.h>
#include <algorithm>
bisection::bisection(QWidget *parent) :
[code]....
View 11 Replies
View Related
Mar 21, 2013
Working on a program that converts infix to postfix math formulas. Ive successfully converted the infix to a postfix notation but now i am having trouble solving the equation from the postfix form. Im trying to set a result equal to three variables as shown below:
result = op1 ch op2;
where op1 and op2 are numbers and ch is the operator (+-*/) depending on what the user entered into a string. The error im getting is that it expected a ";" before postfix so clearly it doesn't understand what im trying to do. how to put the answer from op1 ch op2 into result.
View 4 Replies
View Related
Apr 14, 2013
How can i solve a problem of sin(x) without using any math.h and only using my own declared function.
#include <stdio.h>
int fact (int a) {
int i;
int k = 1;
for (i=1;i<=a;i++)
[Code] ....
View 3 Replies
View Related