设为首页收藏本站淘宝杂货铺

从F到0 - From F to 0

 找回密码
 注册已关闭
搜索
查看: 2162|回复: 1
收起左侧

易语言MASM置入代码实现文本型数组、字节集数组的ROT13算法编解码/加解密(无返回值)

[复制链接]
发表于 2019-8-20 18:01:31 | 显示全部楼层 |阅读模式

  1. .版本 2
  2. .支持库 spec

  3. .程序集 程序集1

  4. .子程序 _启动子程序, 整数型, , 请在本子程序中放置易模块初始化代码


  5. _临时子程序 ()  ' 在初始化代码执行完毕后调用测试代码
  6. 返回 (0)  ' 可以根据您的需要返回任意数值

  7. .子程序 _临时子程序
  8. .局部变量 字节集数组, 字节集, , "5"
  9. .局部变量 文本型数组, 文本型, , "0"

  10. ' 本名称子程序用作测试程序用,仅在开发及调试环境中有效,编译发布程序前将被系统自动清空,请将所有用作测试的临时代码放在本子程序中。 ***注意不要修改本子程序的名称、参数及返回值类型。
  11. 字节集数组 [1] = 到字节集 (“Hello World!”)
  12. 字节集数组 [2] = 到字节集 (“abc123”)

  13. 字节集数组 [3] = 到字节集 (“中文测试”)
  14. 字节集数组 [5] = 到字节集 (“AbCdefghijklmnopqrstuvwxyz”)
  15. 字节集数组_ROT13 (字节集数组)
  16. 调试输出 (到文本 (字节集数组 [1]))
  17. 调试输出 (到文本 (字节集数组 [2]))
  18. 调试输出 (到文本 (字节集数组 [3]))
  19. 调试输出 (到文本 (字节集数组 [4]))
  20. 调试输出 (到文本 (字节集数组 [5]))
  21. 文本型数组 = { “Hello World!”, “abc123”, “AbCdefghijklmnopqrstuvwxyz”, “”, “中文测试” }
  22. 文本型数组_ROT13 (文本型数组)
  23. 调试输出 (文本型数组)

  24. .子程序 文本型数组_ROT13, , 公开
  25. .参数 文本型数组, 文本型, 参考 数组

  26. 置入代码 ({ 96, 139, 69, 8, 11, 192, 117, 2, 235, 107, 139, 0, 11, 192, 117, 2, 235, 99, 139, 88, 4, 11, 219, 116, 8, 129, 251, 0, 0, 0, 128, 114, 2, 235, 82, 131, 192, 8, 51, 201, 235, 71, 139, 52, 136, 11, 246, 117, 2, 235, 61, 138, 22, 10, 210, 117, 2, 235, 53, 128, 250, 65, 114, 5, 128, 250, 77, 118, 10, 128, 250, 97, 114, 10, 128, 250, 109, 119, 5, 128, 194, 13, 235, 23, 128, 250, 78, 114, 5, 128, 250, 90, 118, 10, 128, 250, 110, 114, 8, 128, 250, 122, 119, 3, 128, 234, 13, 136, 22, 70, 235, 195, 65, 59, 203, 114, 181, 97 })
  27. ' pushad
  28. ' mov eax,[ebp+8]
  29. ' .if !eax
  30. ' jmp ASM_END
  31. ' .endif
  32. ' mov eax,[eax]
  33. ' .if !eax
  34. ' jmp ASM_END
  35. ' .endif
  36. ' mov ebx,[eax+4]
  37. ' .if !ebx || ebx >= 80000000H
  38. ' jmp ASM_END
  39. ' .endif
  40. ' add eax,8
  41. ' xor ecx,ecx
  42. ' .while ecx < ebx
  43. ' mov esi,[eax+ecx*4]
  44. ' .if !esi
  45. ' jmp TEXT_LOOP_END
  46. ' .endif
  47. ' TEXT_LOOP:
  48. ' mov dl,[esi]
  49. ' .if !dl
  50. ' jmp TEXT_LOOP_END
  51. ' .endif
  52. ' .if dl >=65 && dl <=77 || dl >=97 && dl <=109
  53. ' add dl,13
  54. ' .elseif dl >=78 && dl <=90 || dl>=110 && dl <=122
  55. ' sub dl,13
  56. ' .endif
  57. ' mov [esi],dl
  58. ' inc esi
  59. ' JMP TEXT_LOOP
  60. ' TEXT_LOOP_END:
  61. ' inc ecx
  62. ' .endw
  63. ' ASM_END:
  64. ' popad


  65. .子程序 字节集数组_ROT13
  66. .参数 字节集数组, 字节集, 参考 数组

  67. 置入代码 ({ 96, 139, 85, 8, 11, 210, 117, 2, 235, 115, 139, 18, 11, 210, 117, 2, 235, 107, 139, 90, 4, 11, 219, 116, 8, 129, 251, 0, 0, 0, 128, 114, 2, 235, 90, 131, 194, 8, 51, 201, 235, 79, 139, 4, 138, 11, 192, 116, 71, 96, 139, 88, 4, 131, 192, 8, 51, 201, 235, 55, 138, 20, 1, 128, 250, 65, 114, 5, 128, 250, 77, 118, 10, 128, 250, 97, 114, 10, 128, 250, 109, 119, 5, 128, 194, 13, 235, 23, 128, 250, 78, 114, 5, 128, 250, 90, 118, 10, 128, 250, 110, 114, 8, 128, 250, 122, 119, 3, 128, 234, 13, 136, 20, 1, 65, 59, 203, 114, 197, 97, 65, 59, 203, 114, 173, 97 })
  68. ' pushad
  69. ' mov edx,[ebp+8]
  70. ' .if !edx
  71. ' jmp  ASM_END
  72. ' .endif
  73. ' mov edx,[edx]
  74. ' .if !edx
  75. ' jmp  ASM_END
  76. ' .endif
  77. ' mov ebx,[edx+4]
  78. ' .if !ebx || ebx >= 80000000H
  79. ' jmp  ASM_END
  80. ' .endif
  81. ' add edx,8
  82. ' xor ecx,ecx
  83. ' .while ecx < ebx
  84. ' mov eax,[edx+ecx*4]
  85. ' .if eax
  86. ' pushad
  87. ' mov ebx,[eax+4]
  88. ' add eax,8
  89. ' xor ecx,ecx
  90. ' .while ecx < ebx
  91. ' mov dl,[eax+ecx]
  92. ' .if dl >=65 && dl <=77 || dl >=97 && dl <=109
  93. ' add dl,13
  94. ' .elseif dl >=78 && dl <=90 || dl>=110 && dl <=122
  95. ' sub dl,13
  96. ' .endif
  97. ' mov [eax+ecx],dl
  98. ' inc ecx
  99. ' .endw
  100. ' popad
  101. ' .endif
  102. ' inc ecx
  103. ' .endw
  104. ' ASM_END:
  105. ' popad

复制代码

相关帖子

您需要登录后才可以回帖 登录 | 注册已关闭

本版积分规则

QQ|手机版|Archiver|从F到0 ( 蒙ICP备17002595号-1 )
蒙公网安备15010402000325号

腾讯云安全认证

GMT+8, 2024-4-20 12:09 , Processed in 0.433025 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表