The invention relates to a lock with a function of acquiring variable passwords by means of scanning functions corresponding to two-dimensional codes by mobile phones, a two-dimensional code identifier and a password lock power supply module, and belongs to the technical field of electronic information and shared locks. The lock comprises four password disks, four password knobs, the two-dimensional code identifier, two-dimensional code built-in holes, elastic push keys, keyboard conductive rubber and the like. Each two-dimensional code corresponds to the corresponding independent function Fn, the functions are stored in memories of a variable password lock (8) and function libraries of background management servers, identical operating results can be obtained as long as identical initial values are available, the two-dimensional codes can be scanned and transmitted by the mobile phones, accordingly, input passwords can be obtained, and unlocking can be carried out. The lock, the two-dimensional code identifier and the password lock power supply module have the advantages that variable password functions can be implemented; warning can be given when the passwords are continuously mistakenly inputted for more than three times; voluntary charge can be completely carried out; the two-dimensional codes of the lock can be scanned by the mobile phones, accordingly, functions of logistics nets can be implemented, the cost of the lock can be lowered to a great extent, development of early lock management programs can be reduced to a great extent, and only background management programs need to be developed.