Update cipher descriptions

This commit is contained in:
2024-04-22 00:03:36 -04:00
parent f40d18e54c
commit 71c50f0608
66 changed files with 1317 additions and 599 deletions

View File

@@ -2,6 +2,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -22,20 +24,27 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
@RequestMapping("/hill")
@PropertySource("classpath:ciphers.properties")
public class HillCipherController{
@Value("${cipher.poly.hill.name}")
private String hillName;
@Value("${cipher.poly.hill.description}")
private String hillDescription;
@GetMapping
public ObjectNode getCipherInfo(){
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.HILL_CIPHER_NAME);
log.info("Getting info for {}", CipherInfoUtil.HILL_CIPHER_NAME);
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, hillName);
log.info("Getting info for {}", hillName);
return CipherInfoUtil.buildInfoNode(CipherInfoUtil.HILL_CIPHER_NAME, CipherInfoUtil.HILL_CIPHER_DESCRIPTION);
return CipherInfoUtil.buildInfoNode(hillName, hillDescription);
}
@PostMapping("/encode")
public ObjectNode encodeHill(@RequestBody ObjectNode cipherParams) throws JsonProcessingException{
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.HILL_CIPHER_NAME);
log.info("Encoding {}", CipherInfoUtil.HILL_CIPHER_NAME);
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, hillName);
log.info("Encoding {}", hillName);
CipherParameterUtil.verifyHillParams(cipherParams);
@@ -57,8 +66,8 @@ public class HillCipherController{
@PostMapping("/decode")
public ObjectNode decodeHill(@RequestBody ObjectNode cipherParams) throws JsonProcessingException{
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, CipherInfoUtil.HILL_CIPHER_NAME);
log.info("Decoding {}", CipherInfoUtil.HILL_CIPHER_NAME);
MDC.put(CipherStreamLoggingAspect.CIPHER_NAME_LOGGING, hillName);
log.info("Decoding {}", hillName);
CipherParameterUtil.verifyHillParams(cipherParams);