The invention relates to a method for entering, on a touch surface (12), a code comprising a first number of characters, the method comprising: a) detecting contact exerted by a user on the touch surface (12); b) emitting, by the touch surface (12), a series of at least one counting vibration (26, 28, 30, 32) that can go up to a second number of vibrations; c) detecting the cessation of contact after a third number of vibrations, which is included between 1 and the second number; d) recording the third number of vibrations, which corresponds to a character of the code; e) repeating steps a) to d) until a number of characters equal to the first number is recorded, wherein, when the series of at least one counting vibration comprises two counting vibrations (26, 28, 30, 32), two consecutive counting vibrations are separated by a time interval (D1, D2, D3), the duration of which is random.