Actually, advise how you can generate a checksum for a certain portion of data (text, part of the read file) - to check the integrity. Sending JavaScript (ajax), processing PHP.
1 answer
Any algorithm for calculating checksums will return the same result in all programming languages. For PHP, there are built-in functions (for example, SHA1 ) For JS, you can use third-party solutions ( CryptoJS or this one ) or write your own (here, again, you can see the source code of ready-made solutions.)
- those. embedded in JS, which have analogues in PHP, no? - Sanya H
- In modern browsers there is the same SHA1 developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/… - Alexey Ten
- Depends on the list of browsers you support. For old this will not be possible. - Offer
- and then come up with for the old? - Sanya H
- What is for the old wrote in the answer - use a ready-made solution or write your own - Ofer
|