Question

In: Computer Science

Topic is cryptography 10.increment the digits 858 of the ISBN of the text (ISBN13: 9780890068588) to...

Topic is cryptography

10.increment the digits 858 of the ISBN of the text (ISBN13: 9780890068588) to be 859. Then, by trial and error, change the check-sum (the last digit of the ISBN), to identify the title of the next book published by Artech House.

Solutions

Expert Solution

function getLastISBNDigit(input) {
    if ((input.length != 10) && (input.length != 13)) return;
    var is10 = (input.length === 10);
    var sum = 0;
    var p = (is10 ? 11 : 3);
    for (var index = 0; index < input.length - 1; index++) {
        sum += ((input[index] === 'X') ? 10 : input[index]) * (p = (is10 ? (p - 1) : ((p + 2) % 4)));
    }
    var moduloClass = (is10 ? 11 : 10);
    var result = (moduloClass - (sum % moduloClass)) % moduloClass;
    return ((result === 10) ? 'X' : result);
}

function getISBN(input) {
    var isbn = {};
    if (input.length > 13) return getISBN(input.substring(0, 13));
    if (input.length === 10) {
        if (isValidISBN(input)) {
            isbn.isbn10 = input;
            isbn.isbn13 = "978" + input;
            isbn.isbn13 = isbn.isbn13.substring(0, 12) + getLastISBNDigit(isbn.isbn13);
        }
    } else if (input.length === 13) {
        if (isValidISBN(input)) {
            isbn.isbn13 = input;
            if (input.startsWith("858")) {
                isbn.isbn10 = input.substring(3);
                isbn.isbn10 = isbn.isbn10.substring(0, 9) + getLastISBNDigit(isbn.isbn10);
            }
        } else if (input.startsWith("858")) {
            return getISBN(input.substring(3));
        }
    }
    return isbn;
}
......Please Give Me POSITIVE Rating It Will Help Me A Lot.....Thank You......

Related Solutions

CIS- Python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10....
CIS- Python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. The last digit, d10, is a checksum, which is calculated from the other nine digits using the following formula: (d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11 If the checksum is 10, the last digit...
One research topic in cryptography is to create homomorphic encryption schemes. In such schemes, it is...
One research topic in cryptography is to create homomorphic encryption schemes. In such schemes, it is possible to do operations on the ciphertext without performing decryption. Give an example of where homomorphic encryption would be useful. You do not have to give a specific cryptographic method but describe a situation where you would want to do computations on ciphertext. Be specific: what is the information, what is encrypted, and what the computation is. Related concept: given an RSA scheme with...
Topic: Encrypt-then-authenticate scheme, Cryptography Let ΠE = (GenE, EncE, DecE) be an encryption scheme and ΠM...
Topic: Encrypt-then-authenticate scheme, Cryptography Let ΠE = (GenE, EncE, DecE) be an encryption scheme and ΠM = (GenM, MacM, VrfyM) be a MAC scheme. (b) Prove that Π is unforgeable for any encryption scheme ΠE (even if not CPA-secure) and any secure MAC scheme ΠM (even if not strongly secure).
Topic: Encrypt-then-authenticate scheme, Cryptography Let ΠE = (GenE, EncE, DecE) be an encryption scheme and ΠM...
Topic: Encrypt-then-authenticate scheme, Cryptography Let ΠE = (GenE, EncE, DecE) be an encryption scheme and ΠM = (GenM, MacM, VrfyM) be a MAC scheme. (a) Formalize the construction of the “encrypt-then-authenticate” scheme Π = (Gen, Enc, Dec) given ΠE and ΠM
7.3 Loops: Output range with increment of 10 IN CORAL LANGUAGE zyBooks Write a program whose...
7.3 Loops: Output range with increment of 10 IN CORAL LANGUAGE zyBooks Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is -15 30, the output is: -15 -5 5 15 25 Ex: If the second integer is less than the first as in 20 5, the output is: Second integer...
Any topic in fatherland (coming to anerixa )text by Kiran desai ?
Any topic in fatherland (coming to anerixa )text by Kiran desai ?
The user enters some text into a textbox. It can contain any characters (letters, digits, spaces,...
The user enters some text into a textbox. It can contain any characters (letters, digits, spaces, punctuation marks, and there is no length limit). When a button Count is hit , display the number of upper-case letters in the inputted phrase. This must be done in visual studios using C#.
10_ Sleep is a topic that is discussed in virtually every chapter of the text, which...
10_ Sleep is a topic that is discussed in virtually every chapter of the text, which indicates that it is extremely important. Provide at least five aversive consequences associated with sleep deprivation.
Principles of Marketing, 15th Edition, Philip T Kotler, Gary Armstrong ISBN-10: 0-13-308404-3 ISBN-13: 978-0-13-308404-7 I need...
Principles of Marketing, 15th Edition, Philip T Kotler, Gary Armstrong ISBN-10: 0-13-308404-3 ISBN-13: 978-0-13-308404-7 I need the answer to this book. 1. Expalin why brand equity is important to the seller. Does ESPN have strong brand equity? How does its brand equity relate to its brand value?
Topic 1 - The Financial Manager and the Company - Text Chapter 1 Issue #1 Included...
Topic 1 - The Financial Manager and the Company - Text Chapter 1 Issue #1 Included with the Topic 1 discussion was the issue of recognising the interests of company stakeholders. Required: a) Comment on whether the issue of stakeholder recognition, conflicts with the overriding financial management objective of the maximisation of owner (shareholder) wealth. b) Why is it often stated that companies looking after the interests of all stakeholders is ‘good’ corporate governance? Include in your discussion what is...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT