- 程式集教程
- 程式集——主頁
- 程式集 - 簡介
- 程式集 - 環境設定
- 程式集 - 基本語法
- 程式集 - 記憶體段
- 程式集 - 暫存器
- 程式集 - 系統呼叫
- 程式集 - 定址模式
- 程式集 - 變數
- 程式集 - 常量
- 程式集 - 算術指令
- 程式集 - 邏輯指令
- 程式集 - 條件
- 程式集 - 迴圈
- 程式集 - 數
- 程式集 - 字串
- 程式集 - 陣列
- 程式集 - 過程
- 程式集 - 遞迴
- 程式集 - 宏
- 程式集 - 檔案管理
- 程式集 - 記憶體管理
- 程式集實用資源
- 程式集 - 快速指南
- 程式集 - 有用資源
- 程式集 - 討論
程式集 - LODS 指令
在密碼學中,凱撒密碼是最簡單的加密技術之一。在此方法中,要加密的資料中的每個字母都由字母表中固定數量位置之後的字母代替。
在此示例中,我們透過用兩個字母之後的字母簡單替換其中的每個字母來加密資料,因此 **a** 將替換為 **c**,**b** 用作 **d**,依此類推。
我們使用 LODS 來將原始字串“password”載入到記憶體中。
section .text global _start ;must be declared for using gcc _start: ;tell linker entry point mov ecx, len mov esi, s1 mov edi, s2 loop_here: lodsb add al, 02 stosb loop loop_here cld rep movsb mov edx,20 ;message length mov ecx,s2 ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data s1 db 'password', 0 ;source len equ $-s1 section .bss s2 resb 10 ;destination
編譯並執行以上程式碼後,它將產生以下結果
rcuuyqtf
assembly_strings.htm
廣告