A method for implementing an algorithm for determining computer file security to detect healthy files and files infected with malware, the security of the file to be checked being determined by a recognition analysis of a formal word to be checked associated with that file, by each regular language of a group of regular languages, called control individual, each regular language of the control individual being constructed on a formal alphabet, the formal alphabet including a plurality of formal letters able to form formal words of one or more regular languages; the method comprising a learning phase (P 1) of the control individual and a checking phase (P 2) of a file to be checked by the control individual, the checking phase (P 2) including the following steps: - providing the control individual developed during the learning phase (P 1); - associating the file to be checked with a formal word to be checked constructed on the formal alphabet; - determining the recognition of the formal word to be checked by each regular language of the control individual; - determining the security of the file to be checked as a function of the number of regular languages of the control individual having recognized the associated formal word to be checked and the number of regular languages of the control individual not having recognized it; the learning phase (P 1) including the following steps: - providing a file database comprising a plurality of learning files whose security is known, and associating formal words with each of these files; - generating individuals by associating each of them with a group of regular languages, the set of individuals forming a population, each individual being associated with a health indicator characterizing its ability to determine the security of the learning files by using the recognition of the formal words associated with these files by the regular languages of that individual; - evolving the population comprising a creation of a new individual from two parent individuals, each new individual including a combination of regular languages associated with its parents, and eliminating individuals having health indicators below a predetermined threshold for this step; - selecting a control individual corresponding to the individual having the best health indicator in the entire population; the health indicator of each individual being a function of the number of regular languages of that individual, able to recognize formal words associated with each of the learning files. - providing the control individual developed during the learning phase (P 1); - associating the file to be checked with a formal word to be checked constructed on the formal alphabet; - determining the recognition of the formal word to be checked by each regular language of the control individual; - determining the security of the file to be checked as a function of the number of regular languages of the control individual having recognized the associated formal word to be checked and the number of regular languages of the control individual not having recognized it; - providing a file database comprising a plurality of learning files whose security is known, and associating formal words with each of these files; - generating individuals by associating each of them with a group of regular languages, the set of individuals forming a population, each individual being associated with a health indicator characterizing its ability to determine the security of the learning files by using the recognition of the formal words associated with these files by the regular languages of that individual; - evolving the population comprising a creation of a new individual from two parent individuals, each new individual including a combination of regular languages associated with its parents, and eliminating individuals having health indicators below a predetermined threshold for this step; - selecting a control individual corresponding to the individual having the best health indicator in the entire population;