• 大小: 10.93MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-12
  • 语言: 其他
  • 标签: nodejs-web  

资源简介

nodejs 开发一个小demo,用于初学者学习,内含登录以及增删改查功能。

资源截图

代码片段和文件信息

#include 
#include 
#include 

#define SCRAMBLE_LENGTH_323 8

typedef unsigned long ulong;
typedef unsigned int uint;
typedef unsigned char uchar;

struct rand_struct {
  unsigned long seed1seed2max_value;
  double max_value_dbl;
};

void hash_password(ulong *result const char *password uint password_len)
{
  register ulong nr=1345345333L add=7 nr2=0x12345671L;
  ulong tmp;
  const char *password_end= password + password_len;
  for (; password < password_end; password++)
  {
    if (*password == ‘ ‘ || *password == ‘\t‘)
      continue;                                 /* skip space in password */
    tmp= (ulong) (uchar) *password;
    nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
    nr2+=(nr2 << 8) ^ nr;
    add+=tmp;
  }
  result[0]=nr & (((ulong) 1L << 31) -1L); /* Don‘t use sign bit (str2int) */;
  result[1]=nr2 & (((ulong) 1L << 31) -1L);
}

void randominit(struct rand_struct *rand_st ulong seed1 ulong seed2)
{                                               /* For mysql 3.21.# */
#ifdef HAVE_purify
  bzero((char*) rand_stsizeof(*rand_st));      /* Avoid UMC varnings */
#endif
  rand_st->max_value= 0x3FFFFFFFL;
  rand_st->max_value_dbl=(double) rand_st->max_value;
  rand_st->seed1=seed1%rand_st->max_value ;
  rand_st->seed2=seed2%rand_st->max_value;
}

double my_rnd(struct rand_struct *rand_st)
{
  rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
  rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
  return (((double) rand_st->seed1)/rand_st->max_value_dbl);
}

void scramble_323(char *to const char *message const char *password)
{
  struct rand_struct rand_st;
  ulong hash_pass[2] hash_message[2];

  if (password && password[0])
  {
    char extra *to_start=to;
    const char *message_end= message + SCRAMBLE_LENGTH_323;
    hash_password(hash_passpassword (uint) strlen(password));
    hash_password(hash_message message SCRAMBLE_LENGTH_323);
    randominit(&rand_sthash_pass[0] ^ hash_message[0]
               hash_pass[1] ^ hash_message[1]);
    for (; message < message_end; message++)
      *to++= (char) (floor(my_rnd(&rand_st)*31)+64);
    extra=(char) (floor(my_rnd(&rand_st)*31));
    while (to_start != to)
      *(to_start++)^=extra;
  }
  *to= 0;
}

int main() {
  const char password1[] = “root“;
  const char password2[] = “long password test“;
  const char password3[] = “saf789yasfbsd89f“;
  ulong result[2];
  char scrm[9]; // SCRAMBLE_LENGTH_323+1
  struct rand_struct rand_st;
  int i;

  // test hash_password
  hash_password((ulong*)result password1 strlen(password1));
  printf(“hash_password(\“%s\“) = %08x%08x\n“ password1 result[0] result[1]);

  hash_password((ulong*)result password2 strlen(password2));
  printf(“hash_password(\“%s\“) = %08x%08x\n“ password2 result[0] result[1]);

  hash_password((ulong*)result password3 strlen(password3));
  printf(“hash_password(\“%s\“) = %08x%08x\n“ password3 result[0] result[1]);


  // test randomin

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-25 16:56  nodejs-web改编版\
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\.idea\
     文件          11  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\.name
     文件         171  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\encodings.xml
     文件         271  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\jsLibraryMappings.xml
     文件         132  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\misc.xml
     文件         285  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\modules.xml
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\.idea\runConfigurations\
     文件         588  2014-03-14 18:23  nodejs-web改编版\nodejs-web\.idea\runConfigurations\app_js.xml
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\.idea\scopes\
     文件         143  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\scopes\scope_settings.xml
     文件         173  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\vcs.xml
     文件         384  2014-03-12 16:32  nodejs-web改编版\nodejs-web\.idea\wdms-nodejs.iml
     文件       23966  2014-03-15 09:45  nodejs-web改编版\nodejs-web\.idea\workspace.xml
     文件        2134  2017-09-27 11:56  nodejs-web改编版\nodejs-web\app.js
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\images\
     文件      170866  2017-09-25 17:26  nodejs-web改编版\nodejs-web\images\1.png
     文件      170866  2017-09-26 08:59  nodejs-web改编版\nodejs-web\images\20170926085916.png
     文件      170866  2017-09-26 09:00  nodejs-web改编版\nodejs-web\images\20170926090043.png
     文件      170866  2017-09-26 11:57  nodejs-web改编版\nodejs-web\images\20170926115733.png
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\node_modules\
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\node_modules\.bin\
     文件         278  2014-03-12 16:26  nodejs-web改编版\nodejs-web\node_modules\.bin\express
     文件         139  2014-03-12 16:26  nodejs-web改编版\nodejs-web\node_modules\.bin\express.cmd
     文件         272  2014-03-12 16:38  nodejs-web改编版\nodejs-web\node_modules\.bin\jade
     文件         133  2014-03-12 16:38  nodejs-web改编版\nodejs-web\node_modules\.bin\jade.cmd
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\node_modules\connect-mysql-session\
     文件          23  2014-03-14 10:55  nodejs-web改编版\nodejs-web\node_modules\connect-mysql-session\.npmignore
     文件          57  2014-03-14 10:55  nodejs-web改编版\nodejs-web\node_modules\connect-mysql-session\index.js
     目录           0  2018-04-25 16:56  nodejs-web改编版\nodejs-web\node_modules\connect-mysql-session\lib\
............此处省略1382个文件信息

评论

共有 条评论

相关资源