www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁 > 嵌入式 > 嵌入式硬件

#include <p16f877.inc>
  ;
  global decrypt
  global key0,key1,key2,key3,key4,key5,key6,key7
  global csr0,csr1,csr2,csr3,csr4,csr5,csr6,csr7,csr8
  ;
  #define hop1 csr0 ; ﹚竡 hop1~4 單? csr1~4
  #define hop2 csr1
  #define hop3 csr2
  #define hop4 csr3
  #define max_code_length .72
  #define code_length .66
  ;
  udata_shr ; difine csr0:csr7 on share memory
  csr0 res 1 ; hopping code 鋇μ?纗??既?竟 (lsb)
  csr1 res 1
  csr2 res 1
  csr3 res 1
  csr4 res 1
  csr5 res 1
  csr6 res 1
  csr7 res 1
  csr8 res 1 ; hopping code 鋇μ?纗??既?竟 (msb)
  ;
  encrypt_data udata 0x20
  key0 res 1 ; 64-bit 稈盞じン戈? (lsb)
  key1 res 1
  key2 res 1
  key3 res 1
  key4 res 1
  key5 res 1
  key6 res 1
  key7 res 1
  ;
  udata
  cnt0 res 1
  cnt1 res 1
  hop_length res 1
  mask res 1
  keeloq_temp res 1
  ;
  ;
  keeloq_code code
  ;
  ;*****************************************************
  ;**** rotate csrs register right 1 bit
  ;*****************************************************
  rot_csrs
  rrf csr8,f
  rrf csr7,f
  rrf csr6,f
  rrf csr5,f
  rrf csr4,f
  rrf csr3,f
  rrf csr2,f
  rrf csr1,f
  rrf csr0,f
  return
  ;
  ;
  ;
  ;
  ;****************************************************************
  ;
  ; function : decrypt ()
  ;
  ; description : decrypts 32 bit [hop1:hop4] using [csr0:csr7]
  ;
  ;****************************************************************
  decrypt
  banksel cnt1
  movlw (.11+1) ; outer loop 11+1 times
  movwf cnt1 ; outer loop 11+1 times
  decrypt_outer
  movlw .48 ; inner loop 48 times
  movwf cnt0 ; inner loop 48 times
  decrypt_inner
  clrwdt ; reset watchdog timer
  movfw cnt1 ; last 48 loops restore the key
  xorlw .1 ; last 48 loops restore the key
  btfsc status,z ; last 48 loops restore the key
  goto rotate_key ; last 48 loops restore the key
  ; the lookup table is compressed into in 4 bytes to save space
  ; use the 3 low index bits to make up an 8-bit bit mask
  ; use the 2 high index bits to look up the value in the table
  ; use the bit mask to isolate the correct bit in the byte
  ; part of the reason for this scheme is because normal table
  ; lookup requires an additional stack level
  bcf status,c ; clear carry (for the left shift)
  movlw .1 ; initialise mask = 1
  btfsc hop3,3 ; shift mask 4x if bit 2 set
  movlw b"00010000" ; shift mask 4x if bit 2 set
  movwf mask ; initialise mask = 1
  btfss hop2,0 ; shift mask another 2x if bit 1 set
  goto $+3
  rlf mask,f
  rlf mask,f
  btfsc hop1,0 ; shift mask another 1x if bit 0 set
  rlf mask,f
  ; mask has now been shifted 0-7 times according to bits 2:1:0
  movlw high table
  movwf pclath
  movlw low table
  movwf keeloq_temp
  movlw 0 ; table index = 0
  btfsc hop4,1
  iorlw .2 ; if bit 3 set add 2 to the table index
  btfsc hop4,6
  iorlw .4 ; if bit 4 set add 4 to the table index
  addwf keeloq_temp,w
  btfsc status,c
  incf pclath,f
  movwf pcl ; add the index to the program counter
  ; [ must be in lower half of page ]
  table
  movlw 0x2e ; bits 4:3 were 00
  goto table_end ; end of lookup
  movlw 0x74 ; bits 4:3 were 01
  goto table_end ; end of lookup
  movlw 0x5c ; bits 4:3 were 10
  goto table_end ; end of lookup
  movlw 0x3a ; bits 4:3 were 11
  table_end
  andwf mask,1 ; isolate the correct bit
  movlw 0 ; copy the bit to bit 7
  btfss status,z ; copy the bit to bit 7
  movlw b"1000

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

9月2日消息,不造車的華為或?qū)⒋呱龈蟮莫?dú)角獸公司,隨著阿維塔和賽力斯的入局,華為引望愈發(fā)顯得引人矚目。

關(guān)鍵字: 阿維塔 塞力斯 華為

加利福尼亞州圣克拉拉縣2024年8月30日 /美通社/ -- 數(shù)字化轉(zhuǎn)型技術(shù)解決方案公司Trianz今天宣布,該公司與Amazon Web Services (AWS)簽訂了...

關(guān)鍵字: AWS AN BSP 數(shù)字化

倫敦2024年8月29日 /美通社/ -- 英國汽車技術(shù)公司SODA.Auto推出其旗艦產(chǎn)品SODA V,這是全球首款涵蓋汽車工程師從創(chuàng)意到認(rèn)證的所有需求的工具,可用于創(chuàng)建軟件定義汽車。 SODA V工具的開發(fā)耗時(shí)1.5...

關(guān)鍵字: 汽車 人工智能 智能驅(qū)動(dòng) BSP

北京2024年8月28日 /美通社/ -- 越來越多用戶希望企業(yè)業(yè)務(wù)能7×24不間斷運(yùn)行,同時(shí)企業(yè)卻面臨越來越多業(yè)務(wù)中斷的風(fēng)險(xiǎn),如企業(yè)系統(tǒng)復(fù)雜性的增加,頻繁的功能更新和發(fā)布等。如何確保業(yè)務(wù)連續(xù)性,提升韌性,成...

關(guān)鍵字: 亞馬遜 解密 控制平面 BSP

8月30日消息,據(jù)媒體報(bào)道,騰訊和網(wǎng)易近期正在縮減他們對日本游戲市場的投資。

關(guān)鍵字: 騰訊 編碼器 CPU

8月28日消息,今天上午,2024中國國際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)開幕式在貴陽舉行,華為董事、質(zhì)量流程IT總裁陶景文發(fā)表了演講。

關(guān)鍵字: 華為 12nm EDA 半導(dǎo)體

8月28日消息,在2024中國國際大數(shù)據(jù)產(chǎn)業(yè)博覽會(huì)上,華為常務(wù)董事、華為云CEO張平安發(fā)表演講稱,數(shù)字世界的話語權(quán)最終是由生態(tài)的繁榮決定的。

關(guān)鍵字: 華為 12nm 手機(jī) 衛(wèi)星通信

要點(diǎn): 有效應(yīng)對環(huán)境變化,經(jīng)營業(yè)績穩(wěn)中有升 落實(shí)提質(zhì)增效舉措,毛利潤率延續(xù)升勢 戰(zhàn)略布局成效顯著,戰(zhàn)新業(yè)務(wù)引領(lǐng)增長 以科技創(chuàng)新為引領(lǐng),提升企業(yè)核心競爭力 堅(jiān)持高質(zhì)量發(fā)展策略,塑強(qiáng)核心競爭優(yōu)勢...

關(guān)鍵字: 通信 BSP 電信運(yùn)營商 數(shù)字經(jīng)濟(jì)

北京2024年8月27日 /美通社/ -- 8月21日,由中央廣播電視總臺(tái)與中國電影電視技術(shù)學(xué)會(huì)聯(lián)合牽頭組建的NVI技術(shù)創(chuàng)新聯(lián)盟在BIRTV2024超高清全產(chǎn)業(yè)鏈發(fā)展研討會(huì)上宣布正式成立。 活動(dòng)現(xiàn)場 NVI技術(shù)創(chuàng)新聯(lián)...

關(guān)鍵字: VI 傳輸協(xié)議 音頻 BSP

北京2024年8月27日 /美通社/ -- 在8月23日舉辦的2024年長三角生態(tài)綠色一體化發(fā)展示范區(qū)聯(lián)合招商會(huì)上,軟通動(dòng)力信息技術(shù)(集團(tuán))股份有限公司(以下簡稱"軟通動(dòng)力")與長三角投資(上海)有限...

關(guān)鍵字: BSP 信息技術(shù)
關(guān)閉
關(guān)閉