An optical device, including: a lock, further comprising: at least one lock slot; at least one locking unit, for locking or unlocking the lock; and at least one actuation unit, each arranged connecting to the locking unit, and each actuation unit further having at least one sensor disposed on the periphery of the lock slot and connected to the locking unit; and a key for the lock, provided for allowing the same to insert into the lock slot of the lock, and the key further comprising: an unlocking unit, having a light-emitting unit arranged at one end of the key and at least one light-guiding element being connected or embedded to the portion of the key that is not occupied by the light-emitting unit so as to be used for guiding light to the sensor, the unlocking unit being characterized in that the unlocking unit further comprises: a plurality of encoding elements, each connected to the at least one light-guiding element, and an encoding reflective plate provided between the at least one light-guiding element and the encoding elements for changing or directing the travelling path of light so as to guide the light that is to be transmitted by the light-guiding element to pass through the encoding elements before reaching the sensor. a lock, further comprising: at least one lock slot; at least one locking unit, for locking or unlocking the lock; and at least one actuation unit, each arranged connecting to the locking unit, and each actuation unit further having at least one sensor disposed on the periphery of the lock slot and connected to the locking unit; and at least one lock slot; at least one locking unit, for locking or unlocking the lock; and at least one actuation unit, each arranged connecting to the locking unit, and each actuation unit further having at least one sensor disposed on the periphery of the lock slot and connected to the locking unit; and a key for the lock, provided for allowing the same to insert into the lock slot of the lock, and the key further comprising: an unlocking unit, having a light-emitting unit arranged at one end of the key and at least one light-guiding element being connected or embedded to the portion of the key that is not occupied by the light-emitting unit so as to be used for guiding light to the sensor, an unlocking unit, having a light-emitting unit arranged at one end of the key and at least one light-guiding element being connected or embedded to the portion of the key that is not occupied by the light-emitting unit so as to be used for guiding light to the sensor, the unlocking unit being characterized in that the unlocking unit further comprises: a plurality of encoding elements, each connected to the at least one light-guiding element, and an encoding reflective plate provided between the at least one light-guiding element and the encoding elements for changing or directing the travelling path of light so as to guide the light that is to be transmitted by the light-guiding element to pass through the encoding elements before reaching the sensor. a plurality of encoding elements, each connected to the at least one light-guiding element, and an encoding reflective plate provided between the at least one light-guiding element and the encoding elements for changing or directing the travelling path of light so as to guide the light that is to be transmitted by the light-guiding element to pass through the encoding elements before reaching the sensor.