The present application relates to the technical field of
DNA storage. Provided are a method and apparatus for
encryption and coding during
DNA storage, and an electronic device and a storage medium. The method for
encryption and coding comprises: acquiring data to be stored, and a first random number sequence and a second random number sequence which are generated by a hyperchaotic pseudo-
random sequence generator; using the first random number sequence to encrypt the data to be stored, so as to obtain
source data; performing
DNA Raptor coding on the
source data, and introducing the second random number sequence into
a DNA Raptor coding process as a
random number seed, so as to obtain at least one piece of coded data; and on the basis of
a DNA base mapping rule, converting each piece of coded data into a corresponding DNA sequence, and generating a target DNA sequence from the DNA sequence corresponding to each piece of coded data. The present application solves the problem in the related art of
data security being not taken into consideration during
DNA storage.