An
encryption and decryption method and apparatus based on uncertain graphs, relating to the fields of computer and
network communication technologies, the
encryption method includes: A1. Obtaining a
plaintext string of length n, constructing a
sequence graph and a sequence matrix using the
ASCII code value corresponding to each character as a vertex and the difference between the
ASCII code values corresponding to adjacent characters as edges; A2. Generating a sequence of uncertain implication subgraphs and an
adjacency matrix of uncertain implication subgraphs based on the number of vertices in the
sequence graph, and making the non-invertible uncertain implication subgraphs in the
sequence graph invertible to obtain a
list of adjacency matrices of invertible uncertain implication subgraphs; A3. Dividing the value of the first vertex of the sequence graph by 2... n The quotient and remainder are obtained. The quotient is added to the order matrix to obtain the
encryption matrix. The invertible matrix with the same index and remainder is queried from the
adjacency matrix list of the invertible uncertain implication subgraph. Finally, the encryption matrix is multiplied by the invertible matrix to obtain the
ciphertext. This solves the
quantum risk and structural incompatibility problem of traditional encryption and improves the security of the string.