An information processing method, comprising: generating a first binary vector from first data; generating a first polynomial that is represented by using, as coefficients, components of the first binary vector in first order that is either ascending order or descending order with respect to degree of the first polynomial; encrypting the first polynomial in a Ring-LWE based homomorphic encryption method that handles a polynomial processing; transmitting the encrypted first polynomial to a computer, wherein the computer is accessible to a storage device that stores an encrypted second polynomial wherein the second polynomial is represented by using, as coefficients, components of a second binary vector generated from second data; performing a predetermined processing (S33, S35) in an encrypted text space by using the encrypted first polynomial and the encrypted second polynomial that is obtained by encrypting a second polynomial in the Ring-LWE based homomorphic encryption method; receiving, from the computer, a result of the predetermined processing; obtaining a third polynomial by decrypting the result of the predetermined processing; said method being characterized in that it further comprises the steps of: identifying a position of a coefficient whose value is zero among coefficients of terms in the third polynomial, wherein the second polynomial is represented by using, as coefficients, components of a second binary vector generated from second data in second order, which is different from the first order, with respect to degree of the second polynomial, and the predetermined processing is defined by a distance calculation expression including a first term of a product of the encrypted first polynomial and first auxiliary data, a second term of a product of the encrypted second polynomial and second auxiliary data and a third term of a product of the encrypted first polynomial and the encrypted second polynomial, thereby reducing the data size and distance calculation cost in secure pattern matching between the first and second data. generating a first binary vector from first data; generating a first polynomial that is represented by using, as coefficients, components of the first binary vector in first order that is either ascending order or descending order with respect to degree of the first polynomial; encrypting the first polynomial in a Ring-LWE based homomorphic encryption method that handles a polynomial processing; transmitting the encrypted first polynomial to a computer, wherein the computer is accessible to a storage device that stores an encrypted second polynomial wherein the second polynomial is represented by using, as coefficients, components of a second binary vector generated from second data; performing a predetermined processing (S33, S35) in an encrypted text space by using the encrypted first polynomial and the encrypted second polynomial that is obtained by encrypting a second polynomial in the Ring-LWE based homomorphic encryption method; receiving, from the computer, a result of the predetermined processing; obtaining a third polynomial by decrypting the result of the predetermined processing; said method being characterized in that it further comprises the steps of: identifying a position of a coefficient whose value is zero among coefficients of terms in the third polynomial, wherein the second polynomial is represented by using, as coefficients, components of a second binary vector generated from second data in second order, which is different from the first order, with respect to degree of the second polynomial, and the predetermined processing is defined by a distance calculation expression including a first term of a product of the encrypted first polynomial and first auxiliary data, a second term of a product of the encrypted second polynomial and second auxiliary data and a third term of a product of the encrypted first polynomial and the encrypted second polynomial, identifying a position of a coefficient whose value is zero among coefficients of terms in the third polynomial, wherein the second polynomial is represented by using, as coefficients, components of a second binary vector generated from second data in second order, which is different from the first order, with respect to degree of the second polynomial, and the predetermined processing is defined by a distance calculation expression including a first term of a product of the encrypted first polynomial and first auxiliary data, a second term of a product of the encrypted second polynomial and second auxiliary data and a third term of a product of the encrypted first polynomial and the encrypted second polynomial, thereby reducing the data size and distance calculation cost in secure pattern matching between the first and second data.