7 views

Uploaded by SunnySelect

AES cycle code R version

- Aritmetica modular.pdf
- 05499461
- 2nd Quarter Exam
- ecc
- Document 1
- Characterization Of N Primes Simultaneously, by Florentin Smarandache
- 9 6 Special Products(3)
- Algebra[1]
- Bonacic,_Vladimir_(1971)_-_Art_as_a_Function_of_Subject,_Cognition,_and_Time.pdf
- 1218 Shift
- lesson plan algebra 2-roots
- Matlab
- AnaS2013.pdf
- Metod Saniga and Michel Planat- Projective Planes Over “Galois” Double Numbers and a Geometrical Principle of Complementarity
- Ranjan Bose Information Theory Coding and Cryptography Solution Manual
- Pure Mathematics Forms 3 4 Min
- Polinomial Legendre1
- Quadratic Eqn. & Inequalities.pdf
- CHAPTER 6 - Transportation
- Implementation of Cyclic Convolution Based on Fnt

You are on page 1of 3

if (strcmp(direction, 'left')) { col <- (seq(from = 0, to=15,by = 5)) cols <- repmat(col,1,4); rows <- repmat(row,4,1); ind_mat <- mod(rows + cols, 16) + 1; matrixout <- matrix( MatrixIn[ind_mat] ,nrow=4,ncol=4,byrow = TRUE); } if (strcmp(direction, 'right')){ col <- (seq(from = 16, to=7,by = -3)) cols <- repmat(col,1,4); rows <- repmat(row,4,1); ind_mat <- mod(rows + cols, 16) + 1; matrixout <- t(matrix(MatrixIn[ind_mat] ,nrow=4,ncol=4,byrow = TRUE)); } return(matrixout); } B <- cycle(matrixin,'left')

# integer to bit representation intToBitVect <- function(x){ tmp <- rev(as.numeric(intToBits(x))) id <- seq_len(match(1,tmp,length(tmp))-1) tmp[-id] } bin2dec <- function(x){ return(strtoi(x, base = 2)); } hex2dec <- function(x){ return(strtoi(x, base = 16)); } bitXor # in library bitwShiftL bitwShiftR ###### aff_trans <- function(b_in) { # AFF_TRANS Apply an affine transformation over GF(2^8). # # # # # # B_OUT = AFF_TRANS (B_IN) applies an affine transformation to the input byte B_IN. The transformation consists of 1. a polynomial modulo multiplication by a predefined multiplication polynomial

# # # #

using a predefined modulo polynomial over GF(2^8) and 2. the addition (XOR) of a predefined addition polynomial B_IN has to be a byte (0 <= B_IN <= 255).

# Define the modulo polynomial # to be used in the modulo operation in poly_mult mod_pol = bin2dec ('100000001'); # Define the multiplication polynomial # In the Rijndael AES Proposal # they say they use the polynomial '11110001', # which is wrong. mult_pol = bin2dec ('00011111'); # Define the addition polynomial add_pol = bin2dec ('01100011'); # Modular polynomial multiplication # of the input byte and the fixed multiplication polynomial temp = poly_mult (b_in, mult_pol, mod_pol); # Add (XOR) the constant (addition polynomial) b_out = bitXor (temp, add_pol); return(b_out); } ##### poly_mult <- function(a, b, mod_pol) # POLY_MULT Polynomial modulo multiplication in GF(2^8). # # AB = POLY_MULT (A, B, MOD_POL) # performs a polynomial multiplication of A and B # in the finite Galois field GF(2^8), # using MOD_POL as the irreducible modulo polynomial. # # A and B have to be bytes (0 <= A, B <= 255). # MOD_POL is of degree 8. # Initialize the product term # to be used on the right-hand side of the XOR-iteration ab = 0; # Loop over every bit of the first factor ("a") # starting with the least significant bit. # This loop multiplies "a" and "b" modulo 2 for( i_bit in 1:8) { # If the current bit is set, # the second factor ("b") has to be multiplied # by the corresponding power of 2 if bitget (a, i_bit)

# The power-2-multiplication is carried out # by the corresponding left shift of the second factor ("b"), b_shift = bitshift (b, i_bit - 1); # and the modulo 2 (XOR) "addition" of the shifted factor ab = bitxor (ab, b_shift); end end # Loop over the 8 most significant bits of the "ab"-product. # This loop reduces the 16-bit-product back to the 8 bits # of a GF(2^8) element by the use of # the irreducible modulo polynomial of degree 8. for i_bit = 16 : -1 : 9 # If the current bit is set, # "ab" (or the reduced "ab" respectively) has to be "divided" # by the modulo polynomial if bitget (ab, i_bit) # The "division" is carried out # by the corresponding left shift of the modulo polynomial, mod_pol_shift = bitshift (mod_pol, i_bit - 9); # and the "subtraction" of the shifted modulo polynomial. # Since both "addition" and "subtraction" are # operations modulo 2 in this context, # both can be achieved via XOR ab = bitxor (ab, mod_pol_shift); end end

- Aritmetica modular.pdfUploaded byPayita60
- 05499461Uploaded byamitytr
- 2nd Quarter ExamUploaded bybjotero
- eccUploaded byS Sowmya Cool
- Document 1Uploaded byMuthumanikandan Hariraman
- Characterization Of N Primes Simultaneously, by Florentin SmarandacheUploaded byAnonymous 0U9j6BLllB
- 9 6 Special Products(3)Uploaded byArden Bacallan
- Algebra[1]Uploaded byepiceci
- Bonacic,_Vladimir_(1971)_-_Art_as_a_Function_of_Subject,_Cognition,_and_Time.pdfUploaded byKenan Riđić
- 1218 ShiftUploaded byHood Robin
- lesson plan algebra 2-rootsUploaded byapi-444979830
- MatlabUploaded byManpreet Singh
- AnaS2013.pdfUploaded byChi Trung Nguyen
- Metod Saniga and Michel Planat- Projective Planes Over “Galois” Double Numbers and a Geometrical Principle of ComplementarityUploaded byJupwe
- Ranjan Bose Information Theory Coding and Cryptography Solution ManualUploaded byANURAG CHAKRABORTY
- Pure Mathematics Forms 3 4 MinUploaded byTinashe Mapape
- Polinomial Legendre1Uploaded byMuhammad Rezza
- Quadratic Eqn. & Inequalities.pdfUploaded byneeraj
- CHAPTER 6 - TransportationUploaded byshirley lyn
- Implementation of Cyclic Convolution Based on FntUploaded byInternational Journal of Research in Engineering and Technology
- shish mba sams ibm varanasi pomUploaded byShish Choudhary
- Discrete LogarithmUploaded byKamau Gabriel
- 5590-5598Uploaded byVignesh Balakrishnan
- 8th a syllabusUploaded byapi-227641016
- D2Uploaded byjfmarques
- Bode RulesUploaded byPrateek Goyal
- 08293823Uploaded byDavidson Estole
- IITD CSL100 AnswersUploaded bysushrut12345
- Derivatives and Integrals_2Uploaded bySiva Kumar Arumugham
- 789Uploaded bymian

- Bericht9 Refitment PowderUploaded bysurenderinindia
- Ndm 13 ProceedingsUploaded byjohnson_rego
- Polynomials - Aaron Pixton - MOP 2010Uploaded byParsasam
- Honeywell Fg1625 Install GuideUploaded byAlarm Grid Home Security and Alarm Monitoring
- Siemens FireFinder XLS Operation Installation Manual1Uploaded bywilug planta
- SPM_Maintworld MVS120613Uploaded byWidodo Muis
- numericalmethods.pdfUploaded bysajeet karkee
- ETL FAQUploaded byLakshmanan Venugopal
- Permissive Overreaching Transfer trip analysisUploaded byFernando Reyes
- NGMP-DASIA10-Paper.pdfUploaded byDonika Markande
- Flowchart BscsUploaded byLe Vuong Duc Anh
- ET ZC413Uploaded byChirag Bhanvadia
- EE305Uploaded byapi-3853441
- How to Make Money With Paid to Click (PTC) SitesUploaded byveerudu
- Research ProjectUploaded byAssad Naseer
- Excitation Sys & SfcUploaded byABVSAI
- Finite Element Method in Engineering 4th Edition 2 DISCRETIZATION of the DOMAINUploaded byRoy Srivastava
- Construct a Grid Computing Environment on Multiple Linux PC ClustersUploaded byYassine Afiniss
- QuestionsUploaded byTushiana Ragoo
- DIR-905L_B2_QIG_v3.10Uploaded byVicente
- Help Me Connect GuideUploaded byJaime Arreola
- 10.Optimized Approach of Sobel Edge Detection Technique Using Xilinx System GeneratorUploaded byshanofa
- Experimental Modal Analysis_paperUploaded byBogdan Bumbacea
- PID ControllerUploaded byabdussamih
- ME_Engineering-Mathematics - solved.pdfUploaded byShah Ghanim
- Euler and Milstein DiscretizationUploaded bymeko1986
- PipelineUploaded byarashmidos200x
- autocad 2dUploaded byglazetm
- Project Report Student Information SystemUploaded byFreeProjectz.com
- tm1602_datasheet-v2Uploaded byAnonymous YDF1ID15zJ