A method of securing a software code (SC) comprising at least one constant value, said method generating a secure software code (SSC) and comprising the steps of: - determining (S1) by a processor in the software code a constant value to be protected, - inserting (S2) by the processor in the software code an indexed array of values such that the constant value to be protected can be determined from one value of the array (X), - replacing (S3) by the processor in the software code the constant value to be protected by a replacement variable, - inserting (S4) by the processor in the software code a first sequence of instructions which, when executed at runtime: ∘ computes (E1) the index (i) in the array of the value (X) from which the constant value to be protected can be determined, ∘ extracts (E2) from said array the value (X) located at said computed index (i) in said array, ∘ from said extracted value (X), determines (E3) the constant value to be protected, ∘ sets (E4) the value of said replacement variable equal to the determined constant value, wherein the first sequence of instructions comprises a second sequence of instructions which, when executed at runtime, returns a first intermediate value (v), and a third sequence of instructions which, when executed at runtime, applies a first transformation function (f) to said first intermediate value (v) to compute said index (i) and wherein the first transformation function (f) is selected at random in a first set of predetermined transformation functions. - determining (S1) by a processor in the software code a constant value to be protected, - inserting (S2) by the processor in the software code an indexed array of values such that the constant value to be protected can be determined from one value of the array (X), - replacing (S3) by the processor in the software code the constant value to be protected by a replacement variable, - inserting (S4) by the processor in the software code a first sequence of instructions which, when executed at runtime: ∘ computes (E1) the index (i) in the array of the value (X) from which the constant value to be protected can be determined, ∘ extracts (E2) from said array the value (X) located at said computed index (i) in said array, ∘ from said extracted value (X), determines (E3) the constant value to be protected, ∘ sets (E4) the value of said replacement variable equal to the determined constant value, wherein the first sequence of instructions comprises a second sequence of instructions which, when executed at runtime, returns a first intermediate value (v), and a third sequence of instructions which, when executed at runtime, applies a first transformation function (f) to said first intermediate value (v) to compute said index (i) and wherein the first transformation function (f) is selected at random in a first set of predetermined transformation functions. ∘ computes (E1) the index (i) in the array of the value (X) from which the constant value to be protected can be determined, ∘ extracts (E2) from said array the value (X) located at said computed index (i) in said array, ∘ from said extracted value (X), determines (E3) the constant value to be protected, ∘ sets (E4) the value of said replacement variable equal to the determined constant value, wherein the first sequence of instructions comprises a second sequence of instructions which, when executed at runtime, returns a first intermediate value (v), and a third sequence of instructions which, when executed at runtime, applies a first transformation function (f) to said first intermediate value (v) to compute said index (i) and wherein the first transformation function (f) is selected at random in a first set of predetermined transformation functions. <EOS>