Algorithm generation 7--CVN, algorithm cvn

Source: Internet
Author: User

Algorithm generation 7--CVN, algorithm cvn

When CVN is calculated, two 64-bit verification keys, KeyA and KeyB, are used.

 

 

1) Data Sources for CVN calculation include: Primary Account (PAN), downtime, and Service Code, which are arranged from left to right.

4123456789012345 + 8701 + 111

 

2) Extend the data source to 128-bit binary data (less than 128-bit right-complement binary 0 ).

41234567890123458701111 + 000000000

 

3) divide 128-bit binary data into two 64-bit data blocks. The leftmost 64-bit is Block1, And the rightmost 64-bit is block2.

KeyA = 0123456789 ABCDEF, Block1 = 4123456789012345

 

4) use KeyA to encrypt block1.

3DES_ENC (Block1, KEYA, ENCA)

ENCA = B76ADDCE71CCC6BE

 

5) The encrypted results of Block1 are different or different from those of block2. Use KeyA to encrypt an exception or result.

Block2 = 8701111000000000

ENCB = XOR (Block2, ENCA)

ENCB = 306BCCDE71CCC6BE

3DES_ENC (ENCB, KEYA, ENCC)

ENCC = BAE6746F6DE1F0E6

KEYB = FEDCBA9876543210

 

6) Use KeyB to decrypt the encrypted result.

3DES_DE (ENCC, KEYB, ENCD)

ENCD = B262ABCB9DE99A63

 

7) Use KeyA to encrypt the decryption result.

3DES_ENC (ENCD, KEYA, ENCE)

ENCE = 8D5625FA78011A0C

 

8) extract the numbers (0-9) from the Left to right to form a group of numbers.

CCRSN = 85625780110

 

9) extract the characters (A-F) in the encryption result from left to right, subtract 10 and combine the remainder array into a group of numbers after the numbers in step (8.

CCRSA = DFAAC

CCRSA-10 = 35002 // each digit minus 10

RST = 85625780110 35002

 

10) the first group of three digits on the left of STEP (9) is the CVN value.

CVN = 856

 


What are the differences between the various compression algorithms of 7zip?

The core logic Code cannot be found. Currently, you can use the provided DLL file to package a shell. Currently, algorithms in China, such as 360 compression, are much worse than those in 7ZIP, and they are not sure. If you want to get the core code, you can imagine

Principle of the twenty-four-Point Algorithm (for example,-5,-13, and addition, subtraction, multiplication, and division of each number can only be used once = 24)

A long holiday is boring for me. When I am bored, I often play twenty-four card games with my classmates during my childhood. The game is simple, that is, using addition, subtraction, multiplication, division, and parentheses to group the four cards into an expression with a value of 24. However, there are some interesting questions. This is not the case. After playing for a while, we encountered a problem: 3, 6, 6, and 10, this is not a difficult question, but we didn't turn our brains at the time ).

Now that the problem arises, we must solve it. While thinking hard, I thought a little thought in my mind-why not compile a program to solve this problem? Isn't there such a program in wenquxing? So this idea should be feasible. I immediately began to think about the algorithm of this program. The first thought was naturally the method of exhaustion (and later I found that I could never think of a better method again, sadly, haha ), this is because I have written a small program that calculates simple expressions with parentheses. As long as I can program the expressions consisting of four numbers and operator numbers, can I use this computing program to complete the twenty-four point computing program? After confirming this idea, I began to think about the details of this problem.
First, let's look at the feasibility. I divide the expressions into three types as follows --
1. Simple Expressions without parentheses.
2. There is a simple expression in parentheses.
3. A complex expression with two parentheses. 4. A complex expression.
At the beginning, I arranged the four numbers. The possible number is 4*3*2*1 = 24. I use a nested function to arrange four numbers. The algorithm is as follows:
/* Ans [] is used to store arrays of various arrays */
/* C [] array for storing four cards */
/* K [] c [] Four card codes, k [I] = I + 1.
Use it to replace c [] for processing, considering that c [] may have the same number */
/* Kans [] temporary generated arrangement and combination */
/* Number of j nested loops */
Int fans (c, k, ans, kans, j)
Int j, k [], c []; char ans [], kans [];
{Int I, p, q, r, h, flag, s [4], t [4] [4];
For (p = 0, q = 0; p <4; p ++)
{For (r = 0, flag = 0; r if (k [p]! = Kans [r]) flag ++;
If (flag = j) t [j] [q ++] = k [p];
}
For (s [j] = 0; s [j] <4-j; s [j] ++)
{Kans [j] = t [j] [s [j];
If (j = 3) {for (h = 0; h <4; h ++)
Ans [2 * h] = c [kans [h]-1];/* adjust the generated permutation and combination in the final table
Location in dashboard */
For (h = 0; h <3; h ++)
Symbol (ans, h);/* Add the operator number to the expression */
}
Else {j ++;
Fans (c, k, ans, kans, j );
J --;
}
}
}

As mentioned in the above function, after the four cards are arranged, add the operator number to the expression. Since there are only four cards, you only need to add three operators. Since each operator number can be repeated, the possible number is 4*4*4 = 64. The nested function is still used to add the operator number. The algorithm is as follows:

/* Ans [], j same as above. Sy [] Stores four operators. H is the expression form. */
Int sans (ans, sy, j, h)
Char ans [], sy []; int j, h;
{Int I, p, k [3], m, n; char ktans [20];
For (k [j] = 0; k [j] <4; k [j] ++)
{Ans [2 * j + 1] = sy [k [j];/* The four numbers just now ...... the remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.