Decoding method and device for magnetic stripe card data and read-write equipment
By introducing a dual threshold detection method in the decoding process of magnetic stripe card data, the problem of uneven amplitude or low decoding success rate of magnetic stripe card with low amplitude is solved, and more accurate waveform detection and decoding is achieved, improving the adaptability and reliability of read and write equipment.
Patent Information
- Application Number
- CN202411922511.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
AI Technical Summary
When the prior art deals with magnetic stripe cards with uneven amplitude or low amplitude, the decoding success rate is low, and the low amplitude waveform cannot be effectively identified and parsed, resulting in reading failure.
Using a dual threshold detection method, a first threshold value and a second threshold value are set, wherein the level height of the second threshold value is lower than the first threshold value. By comparing the waveform amplitude with these two threshold values, the waveform of the magnetic stripe card is decoded in combination with the timestamp information.
The decoding success rate of magnetic stripe card data is improved, especially when the amplitude is uneven or the amplitude is low, low amplitude waveform can be more accurately identified and parsed, which enhances the adaptability and reliability of the reading and writing equipment.
Smart Images

Figure CN119849520A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of signal processing technology, for example, to a method and device for decoding magnetic stripe card data, and a reading and writing device. Background Art
[0002] At present, magnetic stripe cards are the main form of identification cards, with characteristics including high reliability, high recording density and low misreading rate. The information input and reading speed of magnetic stripe cards is fast, thanks to its relatively simple and easy-to-use reading and writing technology, which enables magnetic stripe cards to enter many fields at an early stage on the basis of low cost, such as finance, finance, post and telecommunications, communications, transportation, tourism, medical care, education and hotels.
[0003] The encoding technology of each track of the magnetic stripe card adopts double frequency recording. The decoding of the magnetic stripe card needs to be decoded according to the double frequency encoding rule. Two short peak-to-valley (or valley-to-peak) changes are encoded as 1, and one long peak-to-valley (or valley-to-peak) change is encoded as 0.
[0004] In order to decode the data of magnetic stripe cards, the related art discloses a method of decoding magnetic stripe cards, which sets a threshold value above and below the middle baseline of the waveform of the magnetic stripe card. Once a waveform exceeding the threshold value is detected, the magnetic stripe card operation is determined. The threshold value is used to detect the waveform change of the card swipe, thereby calculating the peak value, valley value and inflection point of the magnetic stripe card waveform, and recording the interval time between the peak value and the valley value to resolve the corresponding 0 and 1 bits.
[0005] In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in the related art:
[0006] For some cards that are severely damaged or are limited by the card making equipment during card making, resulting in uneven amplitude of the card swiping signal, no special treatment is done. When encountering individual bits of waveform, the waveform height cannot reach the threshold height, and thus the decoding operation cannot be triggered. As a result, cards with amplitude deviations cannot be read, resulting in a low decoding success rate for batch card swiping, especially when there are many types of cards.
[0007] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0008] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0009] The embodiments of the present disclosure provide a method and apparatus for decoding magnetic stripe card data, and a reading and writing device to improve the success rate of data decoding.
[0010] In some embodiments, the decoding method for magnetic stripe card data includes: when a card swiping operation is detected, obtaining a magnetic stripe card waveform; wherein the magnetic stripe card waveform includes a timestamp and an amplitude; setting a first threshold and a second threshold; wherein the level of the second threshold is lower than the level of the first threshold; comparing the obtained amplitude with the first threshold and the second threshold respectively to obtain a comparison result; decoding the waveform of the magnetic stripe card according to the comparison result and the obtained timestamp to obtain the magnetic stripe card data.
[0011] Optionally, setting the first threshold and the second threshold includes: setting the first threshold to a fixed value, or setting the first threshold according to the amplitude of the magnetic stripe card waveform; setting the second threshold to a fixed value, or setting the second threshold according to the first threshold.
[0012] Optionally, setting a first threshold value according to the amplitude of the magnetic stripe card waveform includes: obtaining the peak height of the initial waveform of the magnetic stripe card waveform; selecting n peak heights in the initial waveform and calculating the average peak height of the n peak heights; and determining the level height of the first threshold value according to the average peak height.
[0013] Optionally, setting the first threshold according to the amplitude of the magnetic stripe card waveform also includes: after obtaining n+1 peak heights, calculating the average peak height of n peak heights adjacent to the current peak height; and determining the level height of the first threshold according to the average peak height.
[0014] Optionally, setting the second threshold to a fixed value includes: detecting line noise and obtaining the maximum value of the line noise when no card swiping operation is detected; setting the second threshold to a times the maximum value of the line noise; wherein the value of a is greater than 1.
[0015] Optionally, setting the second threshold according to the first threshold includes: acquiring the set first threshold; setting the second threshold to 1 / b of the first threshold; wherein the value of b is greater than 1, and the second threshold is greater than the maximum value of the line noise.
[0016] Optionally, the waveform of the magnetic stripe card is decoded according to the comparison result and the obtained timestamp, including: when the acquired amplitude is higher than a first threshold, performing a parity check and / or a longitudinal redundancy check to decode the waveform of the magnetic stripe card through the acquired timestamp; when the acquired amplitude is lower than the first threshold and higher than a second threshold, marking the waveform position corresponding to the amplitude to perform decoding at the marked point; when the acquired amplitude is lower than the second threshold, determining that the waveform corresponding to the amplitude is an interference signal, and performing decoding after ignoring the interference signal.
[0017] Optionally, when the acquired amplitude is lower than a first threshold value and higher than a second threshold value, the waveform position corresponding to the amplitude is marked for decoding at the marked point, including: performing a parity check and / or a longitudinal redundancy check at the marked point; when the parity check passes and / or the longitudinal redundancy check passes, decoding the waveform of the magnetic stripe card through the acquired timestamp; when the parity check fails and / or the longitudinal redundancy check fails, determining that the waveform at the marked point is an interference signal, and decoding after ignoring the interference signal.
[0018] In some embodiments, the device for decoding magnetic stripe card data includes a processor and a memory storing program instructions, and the processor is configured to execute the above-mentioned method for decoding magnetic stripe card data when running the program instructions.
[0019] In some embodiments, the reading and writing device includes: a reading and writing device body; and a decoding device for magnetic stripe card data as described above, installed in the reading and writing device body.
[0020] The method and device for decoding magnetic stripe card data and the reading and writing device provided in the embodiments of the present disclosure can achieve the following technical effects:
[0021] The disclosed embodiment achieves more accurate detection and decoding of magnetic stripe card waveform data by introducing a first threshold and a second threshold in the magnetic stripe card data decoding process, especially for magnetic stripe cards with uneven amplitude or low amplitude. After detecting the card swiping operation, the magnetic stripe card waveform data containing timestamp and amplitude information is obtained; two thresholds are set, wherein the level height of the second threshold is lower than the first threshold to adapt to waveforms with different amplitudes. The acquired amplitude data is compared with the two thresholds, and the waveform is decoded according to the comparison result and the timestamp information. The decoding success rate of magnetic stripe card data can be improved, especially for cards with uneven amplitude due to damage or card making equipment limitations. With the assistance of the second threshold, low amplitude waveforms can be more accurately identified and parsed, which solves the limitations of the single threshold method in processing cards with uneven amplitude, reduces the situation of reading failure due to amplitude deviation, and enhances the adaptability and reliability of magnetic stripe card reading and writing equipment.
[0022] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0024] Figure 1is a schematic diagram of an implementation environment of a method for decoding magnetic stripe card data according to an embodiment of the present disclosure;
[0025] Figure 2 is a schematic diagram of a method for decoding magnetic stripe card data provided by an embodiment of the present disclosure;
[0026] Figure 3 is a schematic diagram of threshold setting provided by an embodiment of the present disclosure;
[0027] Figure 4 It is a schematic diagram of the change of the magnetic track flipping spacing of the magnetic stripe card provided by the embodiment of the present disclosure;
[0028] Figure 5 is a schematic diagram of another method for decoding magnetic stripe card data provided by an embodiment of the present disclosure;
[0029] Figure 6 is a schematic diagram of a magnetic stripe card waveform with uniform amplitude provided by an embodiment of the present disclosure;
[0030] Figure 7 is a schematic diagram of a magnetic stripe card waveform with uneven amplitude provided by an embodiment of the present disclosure;
[0031] Figure 8 is a schematic diagram of marking points in a magnetic stripe card waveform provided by an embodiment of the present disclosure;
[0032] Fig. 9 It is a schematic diagram of a decoding device for magnetic stripe card data provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0033] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0034] The terms "first", "second", etc. in the technical solutions described in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0035] Unless otherwise stated, the term "plurality" means two or more.
[0036] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0037] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0038] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0039] A magnetic stripe card is a card that complies with the ISO7811 / 2 standard. Its first track can store 76 alphanumeric characters and is read-only after writing. The second track can store 37 numeric characters and is also read-only. The third track is more flexible and can store 104 numeric characters. It has read and write functions and is often used to record important information such as the account balance of a bank card.
[0040] The magnetic areas on the magnetic stripe of a magnetic stripe card are usually coded in binary, and each magnetic area can represent a binary bit, that is, 0 or 1. The reading process includes: the read / write device provides a magnetic field, usually implemented by a magnetic head; when the magnetic stripe card is swiped, the magnetic area is affected by the magnetic field, generating a weak voltage change; the read / write device records these voltage changes and converts them into digital 0 or 1 signals.
[0041] Although magnetic stripe cards are widely used in the field of bank cards as a storage medium, they are easily interfered and damaged by external magnetic field factors, which has a certain impact on the stability of the card's magnetic signal, resulting in problems such as reduced card reading and writing performance and high bit error rate. Therefore, it is necessary to add some special processing mechanisms to the reading and writing equipment to deal with external interference.
[0042] Figure 1 FIG. 1 is a schematic diagram of an implementation environment of a method for decoding magnetic stripe card data according to an embodiment of the present disclosure. Figure 1 As shown, the implementation environment may include a magnetic stripe card 100 and a reading and writing device 200 .
[0043] The read / write device 200 includes a processor 800. When a user swipes a magnetic stripe card 100 on the read / write device 200, the read / write device 200 can detect the data generated by the swiping card and decode it through the processor 800 to obtain the magnetic stripe card data.
[0044] Combination Figure 2 As shown, the embodiment of the present disclosure provides a method for decoding magnetic stripe card data, comprising:
[0045] S201, when a card swiping operation is detected, the processor obtains a magnetic stripe card waveform; wherein the magnetic stripe card waveform includes a timestamp and an amplitude.
[0046] S202: The processor sets a first threshold and a second threshold; wherein a level of the second threshold is lower than a level of the first threshold.
[0047] S203: The processor compares the acquired amplitude with the first threshold and the second threshold respectively to obtain a comparison result.
[0048] S204: The processor decodes the waveform of the magnetic stripe card according to the comparison result and the acquired timestamp to obtain the magnetic stripe card data.
[0049] By adopting the decoding method for magnetic stripe card data provided by the embodiment of the present disclosure, by introducing the first threshold and the second threshold in the magnetic stripe card data decoding process, more accurate detection and decoding of magnetic stripe card waveform data is achieved, especially for magnetic stripe cards with uneven amplitude or low amplitude. After detecting the card swiping operation, the magnetic stripe card waveform data containing timestamp and amplitude information is obtained; two thresholds are set, wherein the level height of the second threshold is lower than the first threshold to adapt to waveforms with different amplitudes. The acquired amplitude data is compared with the two thresholds, and the waveform is decoded according to the comparison result and the timestamp information. The decoding success rate of magnetic stripe card data can be improved, especially for cards with uneven amplitude due to damage or card making equipment limitations. With the assistance of the second threshold, low amplitude waveforms can be more accurately identified and analyzed, which solves the limitations of the single threshold method in processing cards with uneven amplitude, reduces the situation of reading failure due to amplitude deviation, and enhances the adaptability and reliability of magnetic stripe card reading and writing equipment.
[0050] The threshold mentioned in the embodiment of the present disclosure is the absolute value of the height between the set value and the middle baseline, such as Figure 3 As shown, the threshold is located above and below the middle baseline, and appears symmetrically. If it is far away from the middle baseline, it is considered that the threshold increases, and if it is close to the middle baseline, it is considered that the threshold decreases.
[0051] The encoding technology of each track adopts frequency multiplication recording. It allows serial recording of self-clocked data. The encoding consists of data and clock flips. If there is a flux flip between two clock flips, it is marked as "1", and if there is no flux flip between two clock flips, it is marked as "0". Figure 4 shown.
[0052] The decoding of magnetic stripe cards needs to be carried out according to the double frequency coding rule. Two short peak-to-valley (or valley-to-peak) changes are encoded as 1, and one long peak-to-valley (or valley-to-peak) change is encoded as 0. The time width is very important here, that is, the width of a code 0 is approximately equal to two codes 1. The reason why it is "approximately equal" is because the speed of manual card swiping is uneven, but in several consecutive coding areas, the speed will not change suddenly, so the time width of the code will not change suddenly, but there may be errors accumulated over the time of card swiping.
[0053] The time used to record the binary 0 or 1 signal is called a timestamp. If a longer timestamp is detected, it is decoded as 0. If two shorter timestamps with similar time are detected (the sum of the two timestamps is close to the length of the timestamp encoding 0), it is decoded as 1. In addition, during the decoding process, if the signal does not jump within the timestamp, it is decoded as 0. If the signal jumps within the timestamp, it is decoded as 1.
[0054] Optionally, setting the first threshold and the second threshold includes: setting the first threshold to a fixed value, or setting the first threshold according to the amplitude of the magnetic stripe card waveform; setting the second threshold to a fixed value, or setting the second threshold according to the first threshold.
[0055] In the disclosed embodiment, by flexibly setting the first threshold and the second threshold, accurate detection and decoding of the waveform data of the magnetic stripe card are achieved, and the compatibility and decoding success rate of the magnetic stripe card under different conditions are improved. First, the first threshold is set to a fixed value, or the first threshold is dynamically adjusted according to the actual amplitude of the magnetic stripe card waveform to adapt to the amplitude characteristics of different magnetic stripe cards. Then, the second threshold can be set to a fixed value, or the second threshold is dynamically set according to a certain ratio according to the height of the first threshold, so as to ensure that the second threshold can detect low-amplitude waveforms and will not be falsely triggered by line noise. The decoding process can adapt to the amplitude changes of the magnetic stripe card waveform, and whether the amplitude is uniform or uneven, the decoding operation can be accurately triggered by setting the appropriate threshold. The accuracy and reliability of magnetic stripe card data decoding are significantly improved, especially for those magnetic stripe cards whose magnetic signals are unstable due to external interference or damage. By introducing the second threshold mechanism, low-amplitude waveforms can be more effectively identified and parsed, and misreading and missed reading can be reduced, thereby improving the practicality of magnetic stripe cards in various application scenarios.
[0056] Optionally, setting a first threshold value according to the amplitude of the magnetic stripe card waveform includes: obtaining the peak height of the initial waveform of the magnetic stripe card waveform; selecting n peak heights in the initial waveform and calculating the average peak height of the n peak heights; and determining the level height of the first threshold value according to the average peak height.
[0057] In the disclosed embodiment, more accurate detection and decoding of magnetic stripe card data is achieved. First, at the beginning of swiping the magnetic stripe card, the peak height of the initial waveform of the magnetic stripe card waveform is obtained, which is usually achieved by detecting the leading 0 or trailing 0 area at both ends of the magnetic stripe card track. Because the waveforms in these areas are not used for data parsing, they can be used as a reference for determining the threshold. Next, n consecutive peak heights are selected from the initial waveform, and the average of these peak heights is calculated to obtain the average peak height. Finally, the level height of the first threshold is determined based on the average peak height.
[0058] Specifically, 70% to 80% of the average peak height can be taken as the initial value of the first threshold. The method of dynamically setting the first threshold enables the decoding process to adapt to the amplitude characteristics of different cards, especially when the amplitude of the card is uneven or the amplitude is reduced due to wear and tear, the decoding operation can be triggered more accurately.
[0059] Optionally, setting the first threshold according to the amplitude of the magnetic stripe card waveform also includes: after obtaining n+1 peak heights, calculating the average peak height of n peak heights adjacent to the current peak height; and determining the level height of the first threshold according to the average peak height.
[0060] In the disclosed embodiment, by dynamically adjusting the first threshold to adapt to the amplitude change of the magnetic stripe card waveform, more accurate detection and decoding of the magnetic stripe card data is achieved. First, during the magnetic stripe card swiping process, the peak height of the waveform is continuously monitored, and after obtaining the n+1th peak height, the n peak heights adjacent to the current peak height are selected, and the average of these peak heights is calculated to obtain a new average peak height. Then, according to this new average peak height, the level height of the first threshold is dynamically adjusted. The first threshold can be made to dynamically change with the actual amplitude of the magnetic stripe card waveform to adapt to the amplitude characteristics of different cards or different areas of the same card, especially when the card amplitude is uneven or the amplitude is reduced due to wear and tear, the decoding operation can be triggered more accurately. By dynamically adjusting the first threshold, low-amplitude waveforms can be more effectively identified and parsed, thereby making the decoding process more flexible and accurate, and can cope with various amplitude changes that may occur in the use of magnetic stripe cards, ensuring the stability and accuracy of the decoding process.
[0061] Optionally, setting the second threshold to a fixed value includes: detecting line noise and obtaining the maximum value of the line noise when no card swiping operation is detected; setting the second threshold to a times the maximum value of the line noise; wherein the value of a is greater than 1.
[0062] Specifically, the value of a can be 2, 3 or 4.
[0063] In the disclosed embodiment, the second threshold is set to a fixed value to meet the need for noise suppression during the detection and decoding of magnetic stripe card waveform data. Before the magnetic stripe card swiping operation occurs, the white noise on the line is first detected and collected to obtain the maximum value of the line noise. Then, the second threshold is set to a times the maximum noise value, where a is a coefficient greater than 1, to ensure that the second threshold is higher than the line noise level to avoid misjudgment caused by noise triggering. In this way, even in a noisy environment, it can be ensured that only the waveform changes representing the magnetic stripe card data can trigger the second threshold, thereby improving the accuracy and reliability of magnetic stripe card data detection.
[0064] The disclosed embodiment effectively distinguishes the real signal of the magnetic stripe card from the line noise by reasonably setting the second threshold, reduces the misreading caused by noise interference, and can more stably identify the magnetic stripe card waveform and improve the decoding success rate, especially when the magnetic stripe card signal is weak or the line environment is poor. In addition, the anti-interference ability of the system is enhanced, so that the magnetic stripe card reading and writing device can maintain high performance in various environments, improving the applicability of the device and user experience.
[0065] Optionally, setting the second threshold according to the first threshold includes: acquiring the set first threshold; setting the second threshold to 1 / b of the first threshold; wherein the value of b is greater than 1, and the second threshold is greater than the maximum value of the line noise.
[0066] Specifically, the value of b can be 2, 3 or 4.
[0067] In the disclosed embodiment, the second threshold is dynamically set by associating the second threshold with the first threshold. First, the first threshold that has been set is obtained; then, the second threshold is set to 1 / b of the first threshold, where b is a coefficient greater than 1, so that the second threshold is both lower than the first threshold and higher than the maximum value of the line noise, avoiding the interference of the line noise. This allows the second threshold to adapt to the actual waveform amplitude of the magnetic stripe card while maintaining the ability to suppress noise.
[0068] A more accurate and reliable detection of magnetic stripe card waveform data is achieved. Especially when processing magnetic stripe card waveforms with low amplitude, the second threshold can serve as an effective auxiliary threshold to capture waveform changes that may not trigger the first threshold due to too low amplitude, thereby improving the decoding success rate of magnetic stripe card data. In addition, by keeping the second threshold higher than the line noise level, false triggering caused by noise interference is effectively avoided, the system's anti-interference ability is enhanced, and stable operation is ensured in various electromagnetic environments.
[0069] Optionally, the waveform of the magnetic stripe card is decoded according to the comparison result and the obtained timestamp, including: when the acquired amplitude is higher than a first threshold, performing a parity check and / or a longitudinal redundancy check to decode the waveform of the magnetic stripe card through the acquired timestamp; when the acquired amplitude is lower than the first threshold and higher than a second threshold, marking the waveform position corresponding to the amplitude to perform decoding at the marked point; when the acquired amplitude is lower than the second threshold, determining that the waveform corresponding to the amplitude is an interference signal, and performing decoding after ignoring the interference signal.
[0070] Combination Figure 5 As shown, the embodiment of the present disclosure provides another method for decoding magnetic stripe card data, comprising:
[0071] S501, when a card swiping operation is detected, the processor obtains a magnetic stripe card waveform; wherein the magnetic stripe card waveform includes a timestamp and an amplitude.
[0072] S502: The processor sets a first threshold and a second threshold; wherein a level of the second threshold is lower than a level of the first threshold.
[0073] S503: The processor compares the acquired amplitude with the first threshold and the second threshold respectively to obtain a comparison result.
[0074] S504: When the acquired amplitude is higher than the first threshold, the processor performs a parity check and / or a longitudinal redundancy check to decode the waveform of the magnetic stripe card through the acquired timestamp.
[0075] S505: When the acquired amplitude is lower than the first threshold and higher than the second threshold, the processor marks the waveform position corresponding to the amplitude to perform decoding at the marked point.
[0076] S506: When the acquired amplitude is lower than the second threshold, the processor determines that the waveform corresponding to the amplitude is an interference signal, and performs decoding after ignoring the interference signal.
[0077] like Figure 6 As shown, the amplitude of the magnetic stripe card waveform is uniform. When the detected amplitude is higher than the first threshold, a parity check and / or a longitudinal redundancy check will be performed, and the magnetic stripe card waveform will be decoded using the acquired timestamp information to ensure the accuracy of the data.
[0078] like Figure 7 As shown, the amplitude of the magnetic stripe card waveform is uneven. When the amplitude is lower than the first threshold but higher than the second threshold, the system will mark these specific waveform positions so that special decoding processing can be performed at these marked points, so that the waveform that may be difficult to be captured by the first threshold due to its low amplitude can be analyzed and decoded.
[0079] Finally, if the amplitude is lower than the second threshold, the system will determine that these waveforms are interference signals and ignore them during the decoding process to reduce misreading and improve decoding accuracy.
[0080] The accuracy and reliability of magnetic stripe card data decoding are significantly improved through hierarchical threshold management. It is suitable for processing magnetic stripe cards with uneven or low amplitudes, and can ensure that the data on the magnetic stripe card can be accurately parsed even when the magnetic stripe card signal is damaged or interfered. By ignoring interference signals below the second threshold, the system reduces the possibility of misreading. At the same time, the waveform between the two thresholds is marked and specially processed, allowing the system to respond to various complex signal situations more flexibly and improve the ability to identify abnormal waveforms.
[0081] Optionally, when the acquired amplitude is lower than a first threshold value and higher than a second threshold value, the waveform position corresponding to the amplitude is marked for decoding at the marked point, including: performing a parity check and / or a longitudinal redundancy check at the marked point; when the parity check passes and / or the longitudinal redundancy check passes, decoding the waveform of the magnetic stripe card through the acquired timestamp; when the parity check fails and / or the longitudinal redundancy check fails, determining that the waveform at the marked point is an interference signal, and decoding after ignoring the interference signal.
[0082] In the embodiments of the present disclosure, Figure 8 As shown, when processing the waveform data of the magnetic stripe card, a more detailed decoding strategy is adopted for the special case where the amplitude is lower than the first threshold but higher than the second threshold. Specifically, when the amplitude of the waveform of the magnetic stripe card is in this range, the system will specially mark the waveform position and perform parity check and / or longitudinal redundancy check at these marked points. If the waveforms of these marked points pass the parity check and / or longitudinal redundancy check, it means that these waveforms are likely to be valid data of the magnetic stripe card. The system will use the acquired timestamp information to decode these waveforms to recover the data stored on the magnetic stripe card. On the contrary, if the parity check and / or longitudinal redundancy check fail, the system will determine that the waveforms of these marked points are interference signals rather than valid data of the magnetic stripe card. The system will ignore these interference signals and continue to decode the remaining waveform data.
[0083] By distinguishing valid data from interference signals, the misreading caused by interference signals is reduced, especially when the magnetic stripe card signal quality is poor or damaged, which can significantly improve the decoding success rate. In addition, this method also enhances the system's anti-interference ability, ensures stable operation in various electromagnetic environments, and improves the reliability and security of magnetic stripe card reading and writing equipment, which is of great significance for application scenarios such as financial transactions that require extremely high data accuracy.
[0084] Combination Fig. 9As shown, the embodiment of the present disclosure provides a decoding device 90 for magnetic stripe card data, including a processor 900 and a memory 901. Optionally, the device 90 may also include a communication interface 902 and a bus 903. The processor 900, the communication interface 902, and the memory 901 may communicate with each other through the bus 903. The communication interface 902 may be used for information transmission. The processor 900 may call the logic instructions in the memory 901 to execute the decoding method for magnetic stripe card data of the above embodiment.
[0085] In addition, the logic instructions in the memory 901 described above may be implemented in the form of software functional units and when sold or used as independent products, may be stored in a computer-readable storage medium.
[0086] The memory 901 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 900 executes the functional application and data processing by running the program instructions / modules stored in the memory 901, that is, the decoding method for magnetic stripe card data in the above embodiment is implemented.
[0087] The memory 901 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 901 may include a high-speed random access memory and may also include a non-volatile memory.
[0088] The disclosed embodiments provide a read-write device, including: a read-write device body, and the above-mentioned decoding device for magnetic stripe card data. The decoding device for magnetic stripe card data is installed in the read-write device body. The installation relationship described here is not limited to placement inside the read-write device body, but also includes installation connections with other components of the read-write device, including but not limited to physical connections, electrical connections or signal transmission connections. It can be understood by those skilled in the art that the decoding device for magnetic stripe card data can be adapted to a feasible read-write device body, thereby realizing other feasible embodiments.
[0089] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.
[0090] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible changes. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. The parts and features of some embodiments may be included in or replace the parts and features of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0091] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods for each specific application to implement the described functions, but such implementations should not be considered to exceed the scope of the embodiments of the present disclosure. The technicians may clearly understand that, for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above may refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0092] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0093] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A method for decoding magnetic stripe card data, characterized in that: include: When a card swiping operation is detected, a magnetic stripe card waveform is obtained; wherein the magnetic stripe card waveform includes a timestamp and an amplitude; Setting a first threshold and a second threshold; wherein the level of the second threshold is lower than the level of the first threshold; Compare the acquired amplitude with the first threshold and the second threshold respectively to obtain a comparison result; According to the comparison result and the acquired timestamp, the waveform of the magnetic stripe card is decoded to obtain the magnetic stripe card data.
2. The decoding method according to claim 1, characterized in that: Setting the first threshold and the second threshold includes: Setting the first threshold value to a fixed value, or setting the first threshold value according to the amplitude of the magnetic stripe card waveform; The second threshold is set as a fixed value, or the second threshold is set according to the first threshold.
3. The decoding method according to claim 2, characterized in that: Setting a first threshold according to the amplitude of the magnetic stripe card waveform includes: Obtain the peak height of the initial waveform of the magnetic stripe card waveform; Select n peak heights in the initial waveform and calculate the average peak height of the n peak heights; The level height of the first threshold is determined according to the average peak height.
4. The decoding method according to claim 3, characterized in that: The method further comprises setting a first threshold value according to the amplitude of the magnetic stripe card waveform: After obtaining n+1 peak heights, the average peak height of n peak heights adjacent to the current peak height is calculated; The level height of the first threshold is determined according to the average peak height.
5. The decoding method according to claim 2, characterized in that: Setting the second threshold to a fixed value includes: When no card swiping operation is detected, line noise is detected to obtain the maximum value of the line noise; The second threshold is set to a times the maximum value of the line noise; wherein the value of a is greater than 1.
6. The decoding method according to claim 2, characterized in that: Setting the second threshold according to the first threshold includes: Get the set first threshold; The second threshold is set to 1 / b of the first threshold; wherein the value of b is greater than 1, and the second threshold is greater than the maximum value of the line noise.
7. The decoding method according to any one of claims 1 to 5, characterized in that: Based on the comparison result and the acquired timestamp, the waveform of the magnetic stripe card is decoded, including: In the case where the acquired amplitude is higher than a first threshold, performing a parity check and / or a longitudinal redundancy check to decode the waveform of the magnetic stripe card through the acquired timestamp; When the acquired amplitude is lower than the first threshold and higher than the second threshold, marking the waveform position corresponding to the amplitude to perform decoding at the marked point; When the acquired amplitude is lower than the second threshold, it is determined that the waveform corresponding to the amplitude is an interference signal, and decoding is performed after ignoring the interference signal.
8. The decoding method according to claim 7, characterized in that: When the acquired amplitude is lower than the first threshold and higher than the second threshold, a waveform position corresponding to the amplitude is marked to decode at the marked point, including: Perform parity check and / or longitudinal redundancy check at marking points; In the case where the parity check passes and / or the longitudinal redundancy check passes, the waveform of the magnetic stripe card is decoded by using the acquired timestamp; In the case where the parity check fails and / or the longitudinal redundancy check fails, the waveform of the marking point is determined to be an interference signal, and decoding is performed after ignoring the interference signal.
9. A device for decoding magnetic stripe card data, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for decoding magnetic stripe card data according to any one of claims 1 to 8 when running the program instructions.
10. A reading and writing device, characterized in that: include: Read-write device body; The decoding device for magnetic stripe card data as described in claim 9 is installed on the reading and writing device body.