#include <stdio.h> /* printf, fgets */ #include <stdlib.h> /* atoi */ #include <time.h> #include <string> #include <cstring> #include <math.h> #include <sstream> char * getTimeEncodeString(); bool login(char *pass_temp); int main (){ char pass_temp[7]="123456"; printf("%s\n", getTimeEncodeString ()); the printf ( " % D \ n- " , Login (pass_temp)); } BOOL Login ( char * pass_temp) { char * Pass = getTimeEncodeString (); IF (strcmp (pass_temp, Pass) == 0 ) { return to true ; } the else { return to false ; } } char * getTimeEncodeString () { // local static variables as the return value of the static char dest [ . 7 ]; time_t rawtime; Time (& Rawtime); struct (TM) * info; info = localtime (& rawtime); char Buffer [ 32 ]; // the strftime (Buffer, 32, "% Y-M-% D%% H:% M:% S", info); the strftime (Buffer, 32 , " % m% D% H " , info); // string rotation Long Long passlong = atoi (Buffer); // encryption algorithm passlong passlong * = 137 ; char str_temp [ 10 ] ; // Long strings turn ltoa (passlong, str_temp, 10); // taken six characters strncpy (dest, str_temp, . 6 ); return dest; }