A method for sharing a memory in a device (DV1, DV2, DV3) comprising at least one memory and at least two functional entities (E1, E2) arranged on a same support or in a same housing, comprising the steps of: • configuring a first functional entity so that it writes and reads data in at least a first area of the memory, • configuring a second functional entity so that it writes and reads data in at least a second area of the memory, disjoint from the first memory area, characterized in that it comprises the steps of: • assigning to the first functional entity a first data transformation function and a first inverse data transformation function configured to restore and/or verify the validity of data transformed by the first transformation function, • assigning to the second functional entity a second data transformation function and a second inverse data transformation function configured to restore and/or verify the validity of data transformed by the second transformation function, wherein the second inverse transformation function is incompatible with the first transformation function and the first inverse transformation function is incompatible with the second transformation function, • configuring the first functional entity so that it applies the first transformation function to a data word before writing it into the first memory area, and applying the first inverse transformation function to a data word read in the first memory area, and • configuring the second functional entity so that it applies the second transformation function to a data word before writing it into the second memory area, and applying the second inverse transformation function to a data word read in the second memory area by the second functional entity. • configuring a first functional entity so that it writes and reads data in at least a first area of the memory, • configuring a second functional entity so that it writes and reads data in at least a second area of the memory, disjoint from the first memory area, • assigning to the first functional entity a first data transformation function and a first inverse data transformation function configured to restore and/or verify the validity of data transformed by the first transformation function, • assigning to the second functional entity a second data transformation function and a second inverse data transformation function configured to restore and/or verify the validity of data transformed by the second transformation function, wherein the second inverse transformation function is incompatible with the first transformation function and the first inverse transformation function is incompatible with the second transformation function, • configuring the first functional entity so that it applies the first transformation function to a data word before writing it into the first memory area, and applying the first inverse transformation function to a data word read in the first memory area, and • configuring the second functional entity so that it applies the second transformation function to a data word before writing it into the second memory area, and applying the second inverse transformation function to a data word read in the second memory area by the second functional entity.