├── .dockerignore ├── .github └── workflows │ └── build.yml ├── .gitignore ├── Dockerfile ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── build-minify-plugin.gradle ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main ├── appengine │ └── app.yaml ├── java │ └── com │ │ └── dencode │ │ ├── logic │ │ ├── DencodeMapper.java │ │ ├── dencoder │ │ │ ├── AllAllDencoder.java │ │ │ ├── CipherAffineDencoder.java │ │ │ ├── CipherAllDencoder.java │ │ │ ├── CipherAtbashDencoder.java │ │ │ ├── CipherCaesarDencoder.java │ │ │ ├── CipherEnigmaDencoder.java │ │ │ ├── CipherJisKeyboardDencoder.java │ │ │ ├── CipherROT13Dencoder.java │ │ │ ├── CipherROT18Dencoder.java │ │ │ ├── CipherROT47Dencoder.java │ │ │ ├── CipherRailFenceDencoder.java │ │ │ ├── CipherScytaleDencoder.java │ │ │ ├── CipherVigenereDencoder.java │ │ │ ├── ColorAllDencoder.java │ │ │ ├── ColorCMYKDencoder.java │ │ │ ├── ColorCommonDencoder.java │ │ │ ├── ColorHSLDencoder.java │ │ │ ├── ColorHSVDencoder.java │ │ │ ├── ColorNameDencoder.java │ │ │ ├── ColorRGBDencoder.java │ │ │ ├── CommonDencoder.java │ │ │ ├── DateAllDencoder.java │ │ │ ├── DateCTimeDencoder.java │ │ │ ├── DateISO8601Dencoder.java │ │ │ ├── DateJapaneseEraDencoder.java │ │ │ ├── DateRFC2822Dencoder.java │ │ │ ├── DateUnixTimeDencoder.java │ │ │ ├── DateW3CDTFDencoder.java │ │ │ ├── DencodeUtils.java │ │ │ ├── HashAllDencoder.java │ │ │ ├── HashCRC32Dencoder.java │ │ │ ├── HashMD2Dencoder.java │ │ │ ├── HashMD5Dencoder.java │ │ │ ├── HashSHA1Dencoder.java │ │ │ ├── HashSHA256Dencoder.java │ │ │ ├── HashSHA384Dencoder.java │ │ │ ├── HashSHA512Dencoder.java │ │ │ ├── NumberAllDencoder.java │ │ │ ├── NumberBinDencoder.java │ │ │ ├── NumberDecDencoder.java │ │ │ ├── NumberEnglishDencoder.java │ │ │ ├── NumberFractionDencoder.java │ │ │ ├── NumberHexDencoder.java │ │ │ ├── NumberJapaneseDencoder.java │ │ │ ├── NumberNAryDencoder.java │ │ │ ├── NumberOctDencoder.java │ │ │ ├── StringAllDencoder.java │ │ │ ├── StringAscii85Dencoder.java │ │ │ ├── StringBase32Dencoder.java │ │ │ ├── StringBase45Dencoder.java │ │ │ ├── StringBase64Dencoder.java │ │ │ ├── StringBinDencoder.java │ │ │ ├── StringBrailleDencoder.java │ │ │ ├── StringCamelCaseDencoder.java │ │ │ ├── StringCharacterWidthDencoder.java │ │ │ ├── StringFontStyleDencoder.java │ │ │ ├── StringHTMLEscapeDencoder.java │ │ │ ├── StringHexDencoder.java │ │ │ ├── StringKebabCaseDencoder.java │ │ │ ├── StringLetterCaseDencoder.java │ │ │ ├── StringLineSortDencoder.java │ │ │ ├── StringLineUniqueDencoder.java │ │ │ ├── StringMorseCodeDencoder.java │ │ │ ├── StringNamingConventionDencoder.java │ │ │ ├── StringProgramStringDencoder.java │ │ │ ├── StringPunycodeDencoder.java │ │ │ ├── StringQuotedPrintableDencoder.java │ │ │ ├── StringSnakeCaseDencoder.java │ │ │ ├── StringTextInitialsDencoder.java │ │ │ ├── StringTextReverseDencoder.java │ │ │ ├── StringURLEncodingDencoder.java │ │ │ ├── StringUnicodeEscapeDencoder.java │ │ │ ├── StringUnicodeNormalizationDencoder.java │ │ │ └── annotation │ │ │ │ ├── Dencoder.java │ │ │ │ └── DencoderFunction.java │ │ ├── model │ │ │ └── DencodeCondition.java │ │ ├── parser │ │ │ ├── ColorParser.java │ │ │ ├── DateParser.java │ │ │ └── NumberParser.java │ │ └── util │ │ │ ├── CharWidthUtils.java │ │ │ ├── ColorNameUtils.java │ │ │ ├── EnglishNumberUtils.java │ │ │ └── JapaneseNumberUtils.java │ │ └── web │ │ ├── jsp │ │ └── TaglibFunctions.java │ │ ├── model │ │ ├── Message.java │ │ └── ResponseModel.java │ │ ├── server │ │ └── ServerMain.java │ │ └── servlet │ │ ├── AbstractDencodeHttpServlet.java │ │ ├── AbstractHttpServlet.java │ │ ├── HttpReqRes.java │ │ ├── filter │ │ ├── RootCharacterEncodingFilter.java │ │ └── RootQuerySanitizationFilter.java │ │ └── pages │ │ ├── DencodeServlet.java │ │ ├── IndexServlet.java │ │ ├── PolicyServlet.java │ │ ├── RootServlet.java │ │ ├── SitemapServlet.java │ │ ├── _ah │ │ └── WarmupServlet.java │ │ ├── cipher │ │ └── CipherIndexServlet.java │ │ ├── color │ │ └── ColorIndexServlet.java │ │ ├── date │ │ └── DateIndexServlet.java │ │ ├── error │ │ └── Error404Servlet.java │ │ ├── hash │ │ └── HashIndexServlet.java │ │ ├── number │ │ └── NumberIndexServlet.java │ │ └── string │ │ └── StringIndexServlet.java ├── resources │ ├── config.properties │ ├── messages_en.properties │ ├── messages_ja.properties │ └── messages_ru.properties └── webapp │ ├── WEB-INF │ ├── pages │ │ ├── error │ │ │ └── 404.jsp │ │ ├── index.jsp │ │ ├── method-desc_cipher.affine_en.inc.jsp │ │ ├── method-desc_cipher.affine_ja.inc.jsp │ │ ├── method-desc_cipher.affine_ru.inc.jsp │ │ ├── method-desc_cipher.atbash_en.inc.jsp │ │ ├── method-desc_cipher.atbash_ja.inc.jsp │ │ ├── method-desc_cipher.atbash_ru.inc.jsp │ │ ├── method-desc_cipher.caesar_en.inc.jsp │ │ ├── method-desc_cipher.caesar_ja.inc.jsp │ │ ├── method-desc_cipher.caesar_ru.inc.jsp │ │ ├── method-desc_cipher.enigma_en.inc.jsp │ │ ├── method-desc_cipher.enigma_ja.inc.jsp │ │ ├── method-desc_cipher.enigma_ru.inc.jsp │ │ ├── method-desc_cipher.jis-keyboard_en.inc.jsp │ │ ├── method-desc_cipher.jis-keyboard_ja.inc.jsp │ │ ├── method-desc_cipher.jis-keyboard_ru.inc.jsp │ │ ├── method-desc_cipher.rail-fence_en.inc.jsp │ │ ├── method-desc_cipher.rail-fence_ja.inc.jsp │ │ ├── method-desc_cipher.rail-fence_ru.inc.jsp │ │ ├── method-desc_cipher.rot13_en.inc.jsp │ │ ├── method-desc_cipher.rot13_ja.inc.jsp │ │ ├── method-desc_cipher.rot13_ru.inc.jsp │ │ ├── method-desc_cipher.rot18_en.inc.jsp │ │ ├── method-desc_cipher.rot18_ja.inc.jsp │ │ ├── method-desc_cipher.rot18_ru.inc.jsp │ │ ├── method-desc_cipher.rot47_en.inc.jsp │ │ ├── method-desc_cipher.rot47_ja.inc.jsp │ │ ├── method-desc_cipher.rot47_ru.inc.jsp │ │ ├── method-desc_cipher.scytale_en.inc.jsp │ │ ├── method-desc_cipher.scytale_ja.inc.jsp │ │ ├── method-desc_cipher.scytale_ru.inc.jsp │ │ ├── method-desc_cipher.vigenere_en.inc.jsp │ │ ├── method-desc_cipher.vigenere_ja.inc.jsp │ │ ├── method-desc_cipher.vigenere_ru.inc.jsp │ │ ├── method-desc_date.ctime_en.inc.jsp │ │ ├── method-desc_date.ctime_ja.inc.jsp │ │ ├── method-desc_date.ctime_ru.inc.jsp │ │ ├── method-desc_date.iso8601_en.inc.jsp │ │ ├── method-desc_date.iso8601_ja.inc.jsp │ │ ├── method-desc_date.iso8601_ru.inc.jsp │ │ ├── method-desc_date.japanese-era_en.inc.jsp │ │ ├── method-desc_date.japanese-era_ja.inc.jsp │ │ ├── method-desc_date.japanese-era_ru.inc.jsp │ │ ├── method-desc_date.rfc2822_en.inc.jsp │ │ ├── method-desc_date.rfc2822_ja.inc.jsp │ │ ├── method-desc_date.rfc2822_ru.inc.jsp │ │ ├── method-desc_date.unix-time_en.inc.jsp │ │ ├── method-desc_date.unix-time_ja.inc.jsp │ │ ├── method-desc_date.unix-time_ru.inc.jsp │ │ ├── method-desc_date.w3cdtf_en.inc.jsp │ │ ├── method-desc_date.w3cdtf_ja.inc.jsp │ │ ├── method-desc_date.w3cdtf_ru.inc.jsp │ │ ├── method-desc_number.bin_en.inc.jsp │ │ ├── method-desc_number.bin_ja.inc.jsp │ │ ├── method-desc_number.bin_ru.inc.jsp │ │ ├── method-desc_number.dec_en.inc.jsp │ │ ├── method-desc_number.dec_ja.inc.jsp │ │ ├── method-desc_number.dec_ru.inc.jsp │ │ ├── method-desc_number.english_en.inc.jsp │ │ ├── method-desc_number.english_ja.inc.jsp │ │ ├── method-desc_number.english_ru.inc.jsp │ │ ├── method-desc_number.hex_en.inc.jsp │ │ ├── method-desc_number.hex_ja.inc.jsp │ │ ├── method-desc_number.hex_ru.inc.jsp │ │ ├── method-desc_number.japanese_en.inc.jsp │ │ ├── method-desc_number.japanese_ja.inc.jsp │ │ ├── method-desc_number.japanese_ru.inc.jsp │ │ ├── method-desc_number.oct_en.inc.jsp │ │ ├── method-desc_number.oct_ja.inc.jsp │ │ ├── method-desc_number.oct_ru.inc.jsp │ │ ├── method-desc_string.ascii85_en.inc.jsp │ │ ├── method-desc_string.ascii85_ja.inc.jsp │ │ ├── method-desc_string.ascii85_ru.inc.jsp │ │ ├── method-desc_string.base32_en.inc.jsp │ │ ├── method-desc_string.base32_ja.inc.jsp │ │ ├── method-desc_string.base32_ru.inc.jsp │ │ ├── method-desc_string.base45_en.inc.jsp │ │ ├── method-desc_string.base45_ja.inc.jsp │ │ ├── method-desc_string.base45_ru.inc.jsp │ │ ├── method-desc_string.base64_en.inc.jsp │ │ ├── method-desc_string.base64_ja.inc.jsp │ │ ├── method-desc_string.base64_ru.inc.jsp │ │ ├── method-desc_string.bin_en.inc.jsp │ │ ├── method-desc_string.bin_ja.inc.jsp │ │ ├── method-desc_string.bin_ru.inc.jsp │ │ ├── method-desc_string.camel-case_en.inc.jsp │ │ ├── method-desc_string.camel-case_ja.inc.jsp │ │ ├── method-desc_string.camel-case_ru.inc.jsp │ │ ├── method-desc_string.character-width_en.inc.jsp │ │ ├── method-desc_string.character-width_ja.inc.jsp │ │ ├── method-desc_string.character-width_ru.inc.jsp │ │ ├── method-desc_string.hex_en.inc.jsp │ │ ├── method-desc_string.hex_ja.inc.jsp │ │ ├── method-desc_string.hex_ru.inc.jsp │ │ ├── method-desc_string.kebab-case_en.inc.jsp │ │ ├── method-desc_string.kebab-case_ja.inc.jsp │ │ ├── method-desc_string.kebab-case_ru.inc.jsp │ │ ├── method-desc_string.naming-convention_en.inc.jsp │ │ ├── method-desc_string.naming-convention_ja.inc.jsp │ │ ├── method-desc_string.naming-convention_ru.inc.jsp │ │ ├── method-desc_string.program-string_en.inc.jsp │ │ ├── method-desc_string.program-string_ja.inc.jsp │ │ ├── method-desc_string.program-string_ru.inc.jsp │ │ ├── method-desc_string.quoted-printable_en.inc.jsp │ │ ├── method-desc_string.quoted-printable_ja.inc.jsp │ │ ├── method-desc_string.quoted-printable_ru.inc.jsp │ │ ├── method-desc_string.snake-case_en.inc.jsp │ │ ├── method-desc_string.snake-case_ja.inc.jsp │ │ ├── method-desc_string.snake-case_ru.inc.jsp │ │ ├── method-desc_string.unicode-escape_en.inc.jsp │ │ ├── method-desc_string.unicode-escape_ja.inc.jsp │ │ ├── method-desc_string.unicode-escape_ru.inc.jsp │ │ ├── method-desc_string.unicode-normalization_en.inc.jsp │ │ ├── method-desc_string.unicode-normalization_ja.inc.jsp │ │ ├── method-desc_string.unicode-normalization_ru.inc.jsp │ │ ├── policy_en.inc.jsp │ │ ├── policy_ja.inc.jsp │ │ ├── policy_ru.inc.jsp │ │ └── sitemap.jsp │ ├── taglib.tld │ └── web.xml │ ├── ads.txt │ ├── favicon.ico │ ├── manifest.json │ ├── robots.txt │ └── static │ ├── css │ └── main.css │ ├── img │ └── icons │ │ ├── apple-touch-icon.png │ │ ├── apple-touch-icon.svg │ │ ├── icon-192.png │ │ ├── icon-512.png │ │ ├── icon-logo.svg │ │ ├── icon-maskable-512.png │ │ ├── icon-maskable.svg │ │ └── icon.svg │ └── js │ ├── adsense.js │ ├── analytics.js │ ├── commons.js │ └── main.js └── test └── java └── com └── dencode └── logic ├── dencoder ├── CipherAffineDencoderTest.java ├── CipherAtbashDencoderTest.java ├── CipherJisKeyboardDencoderTest.java ├── CipherScytaleDencoderTest.java ├── CipherVigenereDencoderTest.java ├── NumberBinDencoderTest.java ├── NumberDecDencoderTest.java ├── NumberFractionDencoderTest.java ├── NumberHexDencoderTest.java ├── NumberOctDencoderTest.java ├── StringAscii85DencoderTest.java ├── StringBase32DencoderTest.java ├── StringBase45DencoderTest.java ├── StringBase64DencoderTest.java ├── StringBrailleDencoderTest.java ├── StringMorseCodeDencoderTest.java ├── StringQuotedPrintableDencoderTest.java ├── StringURLEncodingDencoderTest.java └── StringUnicodeEscapeDencoderTest.java ├── parser └── NumberParserTest.java └── util ├── EnglishNumberUtilsTest.java └── JapaneseNumberUtilsTest.java /.dockerignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build 3 | *.iml 4 | *.log 5 | .idea 6 | .vscode 7 | .DS_Store -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build and Push Docker image to GHCR 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build-and-push: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | packages: write 13 | contents: read 14 | 15 | steps: 16 | # Step 1: Checkout the repository 17 | - name: Checkout repository 18 | uses: actions/checkout@v3 19 | 20 | # Step 2: Log in to GitHub Container Registry (GHCR) 21 | - name: Log in to GitHub Container Registry 22 | uses: docker/login-action@v2 23 | with: 24 | registry: ghcr.io 25 | username: ${{ github.actor }} 26 | password: ${{ secrets.GITHUB_TOKEN }} 27 | 28 | # Step 3: Build the Docker image 29 | - name: Build Docker image 30 | run: | 31 | IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/dencode-web:latest 32 | docker build -t $IMAGE_NAME . 33 | 34 | # Step 4: Push the Docker image to GitHub Container Registry 35 | - name: Push Docker image to GHCR 36 | run: | 37 | IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/dencode-web:latest 38 | docker push $IMAGE_NAME -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS 2 | .DS_Store 3 | Thumbs.db 4 | 5 | # Eclipse 6 | /.project 7 | /.classpath 8 | /.settings/ 9 | /.externalToolBuilders/ 10 | 11 | # Maven 12 | /target/ 13 | 14 | # Gradle 15 | /.gradle/ 16 | /build/ 17 | 18 | # Java 19 | *.class 20 | 21 | # Others 22 | *.bak 23 | /bin/ 24 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use OpenJDK 21 as the base image 2 | FROM openjdk:21-jdk-slim 3 | 4 | # Installing required dependencies 5 | RUN apt-get update && apt-get install -yq \ 6 | findutils \ 7 | python3 \ 8 | curl \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | # Set environment variables! 12 | ENV APP_HOME=/app 13 | 14 | # Create application directory 15 | WORKDIR $APP_HOME 16 | 17 | # Copy the project files to the container 18 | COPY . . 19 | 20 | # Grant execute permission for gradlew 21 | RUN chmod +x ./gradlew 22 | 23 | # Set GRADLE_USER_HOME to avoid permission issues 24 | ENV GRADLE_USER_HOME=$APP_HOME/gradle-cache 25 | 26 | # Run the Gradle build to fetch dependencies and build the project 27 | RUN ./gradlew clean build --no-daemon 28 | 29 | # Expose the default port the app runs on 30 | EXPOSE 8080 31 | 32 | # Command to run the application 33 | CMD ["./gradlew", "appRunStage", "--no-daemon"] -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | dencode-web 2 | Copyright 2016 Mozq 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /build-minify-plugin.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath group: 'com.google.javascript', name: 'closure-compiler', version: 'v20250402' 8 | } 9 | } 10 | 11 | import com.google.javascript.jscomp.CompilationLevel 12 | import com.google.javascript.jscomp.Compiler 13 | import com.google.javascript.jscomp.CompilerOptions 14 | import com.google.javascript.jscomp.CompilerOptions.LanguageMode 15 | import com.google.javascript.jscomp.SourceFile 16 | import com.google.javascript.jscomp.WarningLevel 17 | import java.nio.charset.Charset 18 | 19 | 20 | abstract class SourceDestTask extends SourceTask { 21 | @Input String charset = 'UTF-8' 22 | @Input String dest 23 | @OutputFile File getDestFile() { project.file(dest) } 24 | } 25 | 26 | abstract class MinifyJsTask extends SourceDestTask { 27 | @Input String compilationLevel = 'SIMPLE_OPTIMIZATIONS' 28 | @Input String warningLevel = 'DEFAULT' 29 | @Input String languageIn = 'STABLE' 30 | @Input String languageOut = 'STABLE' 31 | 32 | @TaskAction 33 | void minify() { 34 | def options = new CompilerOptions() 35 | CompilationLevel.fromString(compilationLevel).setOptionsForCompilationLevel(options) 36 | WarningLevel.valueOf(warningLevel).setOptionsForWarningLevel(options) 37 | options.setLanguageIn(LanguageMode.fromString(languageIn)) 38 | options.setLanguageOut(LanguageMode.fromString(languageOut)) 39 | 40 | def compiler = new Compiler() 41 | def result = compiler.compile([], source.files.collect { SourceFile.fromPath(it.toPath(), Charset.forName(charset)) }, options) 42 | 43 | result.warnings.each { 44 | logger.warn("WARN: " + it.toString()) 45 | } 46 | 47 | if (result.success) { 48 | project.file(dest).parentFile.mkdirs() 49 | project.file(dest).write(compiler.toSource(), charset) 50 | } else { 51 | throw new RuntimeException(result.errors.join('\n')) 52 | } 53 | } 54 | } 55 | 56 | project.tasks.register('minifyJs', MinifyJsTask) 57 | project.ext.MinifyJsTask = MinifyJsTask 58 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozq/dencode-web/9e9ac26fddacf9f632309bbbbaeeec924cff252b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | // Google App Engine plugin 2 | // See: 3 | // - https://github.com/GoogleCloudPlatform/app-gradle-plugin 4 | pluginManagement { 5 | repositories { 6 | gradlePluginPortal() 7 | maven { url 'https://jitpack.io' } 8 | } 9 | 10 | resolutionStrategy { 11 | eachPlugin { 12 | if (requested.id.id.startsWith('com.google.cloud.tools.appengine')) { 13 | useModule("com.google.cloud.tools:appengine-gradle-plugin:${requested.version}") 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/appengine/app.yaml: -------------------------------------------------------------------------------- 1 | runtime: java21 2 | entrypoint: 'java -cp "*" com.dencode.web.server.ServerMain' 3 | 4 | inbound_services: 5 | - warmup 6 | 7 | handlers: 8 | - url: .* 9 | script: dummy 10 | secure: always 11 | 12 | automatic_scaling: 13 | min_idle_instances: automatic 14 | max_idle_instances: 1 15 | min_pending_latency: 2000ms 16 | max_pending_latency: automatic 17 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/AllAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="all", method="all.all", hasEncoder=true, hasDecoder=true, useOe=true, useNl=true, useTz=true) 22 | public class AllAllDencoder { 23 | 24 | private AllAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/CipherAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="cipher", method="cipher.all", hasEncoder=true, hasDecoder=true) 22 | public class CipherAllDencoder { 23 | 24 | private CipherAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/CipherROT13Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="cipher", method="cipher.rot13", hasEncoder=true, hasDecoder=true) 24 | public class CipherROT13Dencoder { 25 | 26 | private CipherROT13Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encCipherROT13(DencodeCondition cond) { 33 | return dencCipherROT13(cond.value()); 34 | } 35 | 36 | @DencoderFunction 37 | public static String decCipherROT13(DencodeCondition cond) { 38 | return dencCipherROT13(cond.value()); 39 | } 40 | 41 | 42 | private static String dencCipherROT13(String val) { 43 | if (val == null || val.isEmpty()) { 44 | return val; 45 | } 46 | 47 | int len = val.length(); 48 | 49 | StringBuilder sb = new StringBuilder(len); 50 | for (int i = 0; i < len; i++) { 51 | char ch = val.charAt(i); 52 | 53 | if (('A' <= ch && ch <= 'M') || ('a' <= ch && ch <= 'm')) { 54 | // Half-width Latin alphabets 55 | ch += 13; 56 | } else if (('N' <= ch && ch <= 'Z') || ('n' <= ch && ch <= 'z')) { 57 | // Half-width Latin alphabets 58 | ch -= 13; 59 | } else if (('A' <= ch && ch <= 'M') || ('a' <= ch && ch <= 'm')) { 60 | // Full-width Latin alphabets 61 | ch += 13; 62 | } else if (('N' <= ch && ch <= 'Z') || ('n' <= ch && ch <= 'z')) { 63 | // Full-width Latin alphabets 64 | ch -= 13; 65 | } 66 | 67 | sb.append(ch); 68 | } 69 | 70 | return sb.toString(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/CipherROT18Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="cipher", method="cipher.rot18", hasEncoder=true, hasDecoder=true) 24 | public class CipherROT18Dencoder { 25 | 26 | private CipherROT18Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encCipherROT18(DencodeCondition cond) { 33 | return dencCipherROT18(cond.value()); 34 | } 35 | 36 | @DencoderFunction 37 | public static String decCipherROT18(DencodeCondition cond) { 38 | return dencCipherROT18(cond.value()); 39 | } 40 | 41 | 42 | private static String dencCipherROT18(String val) { 43 | if (val == null || val.isEmpty()) { 44 | return val; 45 | } 46 | 47 | int len = val.length(); 48 | 49 | StringBuilder sb = new StringBuilder(len); 50 | for (int i = 0; i < len; i++) { 51 | char ch = val.charAt(i); 52 | 53 | if (('A' <= ch && ch <= 'M') || ('a' <= ch && ch <= 'm')) { 54 | // Half-width Latin alphabets 55 | ch += 13; 56 | } else if (('N' <= ch && ch <= 'Z') || ('n' <= ch && ch <= 'z')) { 57 | // Half-width Latin alphabets 58 | ch -= 13; 59 | } else if ('0' <= ch && ch <= '4') { 60 | // Half-width numbers 61 | ch += 5; 62 | } else if ('5' <= ch && ch <= '9') { 63 | // Half-width numbers 64 | ch -= 5; 65 | } else if (('A' <= ch && ch <= 'M') || ('a' <= ch && ch <= 'm')) { 66 | // Full-width Latin alphabets 67 | ch += 13; 68 | } else if (('N' <= ch && ch <= 'Z') || ('n' <= ch && ch <= 'z')) { 69 | // Full-width Latin alphabets 70 | ch -= 13; 71 | } else if ('0' <= ch && ch <= '4') { 72 | // Full-width numbers 73 | ch += 5; 74 | } else if ('5' <= ch && ch <= '9') { 75 | // Full-width numbers 76 | ch -= 5; 77 | } 78 | 79 | sb.append(ch); 80 | } 81 | 82 | return sb.toString(); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/CipherROT47Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="cipher", method="cipher.rot47", hasEncoder=true, hasDecoder=true) 24 | public class CipherROT47Dencoder { 25 | 26 | private CipherROT47Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encCipherROT47(DencodeCondition cond) { 33 | return dencCipherROT47(cond.value()); 34 | } 35 | 36 | @DencoderFunction 37 | public static String decCipherROT47(DencodeCondition cond) { 38 | return dencCipherROT47(cond.value()); 39 | } 40 | 41 | 42 | private static String dencCipherROT47(String val) { 43 | if (val == null || val.isEmpty()) { 44 | return val; 45 | } 46 | 47 | int len = val.length(); 48 | 49 | StringBuilder sb = new StringBuilder(len); 50 | for (int i = 0; i < len; i++) { 51 | char ch = val.charAt(i); 52 | 53 | if ('!' <= ch && ch <= '~') { 54 | // Half-width characters 55 | ch = (char)((ch - '!' + 47) % 94 + '!'); 56 | } else if ('!' <= ch && ch <= '~') { 57 | // Full-width characters 58 | ch = (char)((ch - '!' + 47) % 94 + '!'); 59 | } 60 | 61 | sb.append(ch); 62 | } 63 | 64 | return sb.toString(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/ColorAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="color", method="color.all", hasEncoder=true, hasDecoder=false) 22 | public class ColorAllDencoder { 23 | 24 | private ColorAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/ColorCMYKDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import static com.dencode.logic.dencoder.DencodeUtils.appendRoundString; 20 | 21 | import java.math.RoundingMode; 22 | import java.util.List; 23 | 24 | import com.dencode.logic.dencoder.annotation.Dencoder; 25 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 26 | import com.dencode.logic.model.DencodeCondition; 27 | 28 | @Dencoder(type="color", method="color.cmyk", hasEncoder=true, hasDecoder=false) 29 | public class ColorCMYKDencoder { 30 | 31 | private ColorCMYKDencoder() { 32 | // NOP 33 | } 34 | 35 | 36 | @DencoderFunction 37 | public static String encColorCMYKFn(DencodeCondition cond) { 38 | return encColorCMYKFn(cond.valueAsColors()); 39 | } 40 | 41 | 42 | private static String encColorCMYKFn(List vals) { 43 | return DencodeUtils.dencodeLines(vals, (rgba) -> { 44 | if (rgba == null) { 45 | return null; 46 | } 47 | 48 | double r = rgba[0]; 49 | double g = rgba[1]; 50 | double b = rgba[2]; 51 | double a = rgba[3]; 52 | 53 | double c = 1.0 - r; 54 | double m = 1.0 - g; 55 | double y = 1.0 - b; 56 | double k = 0.0; 57 | 58 | if (Double.compare(c, m) == 0 && Double.compare(m, y) == 0) { 59 | k = c; 60 | c = m = y = 0.0; 61 | } 62 | 63 | boolean hasAlpha = (Double.compare(a, 1.0) != 0); 64 | 65 | StringBuilder sb = new StringBuilder(); 66 | sb.append("device-cmyk("); 67 | appendRoundString(sb, c * 100.0, 2, RoundingMode.HALF_UP); 68 | sb.append('%'); 69 | sb.append(' '); 70 | appendRoundString(sb, m * 100.0, 2, RoundingMode.HALF_UP); 71 | sb.append('%'); 72 | sb.append(' '); 73 | appendRoundString(sb, y * 100.0, 2, RoundingMode.HALF_UP); 74 | sb.append('%'); 75 | sb.append(' '); 76 | appendRoundString(sb, k * 100.0, 2, RoundingMode.HALF_UP); 77 | sb.append('%'); 78 | if (hasAlpha) { 79 | sb.append(" / "); 80 | appendRoundString(sb, a, 2, RoundingMode.HALF_UP); 81 | } 82 | sb.append(')'); 83 | 84 | return sb.toString(); 85 | }); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/ColorCommonDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="color", method="*", hasEncoder=true, hasDecoder=false) 24 | public class ColorCommonDencoder { 25 | 26 | private ColorCommonDencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encColorRGBHex(DencodeCondition cond) { 33 | return ColorRGBDencoder.encColorRGBHex(cond); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/ColorNameDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.List; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | import com.dencode.logic.util.ColorNameUtils; 25 | 26 | @Dencoder(type="color", method="color.name", hasEncoder=true, hasDecoder=false) 27 | public class ColorNameDencoder { 28 | 29 | private ColorNameDencoder() { 30 | // NOP 31 | } 32 | 33 | 34 | @DencoderFunction 35 | public static String encColorName(DencodeCondition cond) { 36 | return encColorName(cond.valueAsColors()); 37 | } 38 | 39 | 40 | private static String encColorName(List vals) { 41 | return DencodeUtils.dencodeLines(vals, (rgba) -> { 42 | if (rgba == null) { 43 | return null; 44 | } 45 | 46 | return ColorNameUtils.toName(rgba); 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/CommonDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="*", method="*", hasEncoder=false, hasDecoder=false) 24 | public class CommonDencoder { 25 | 26 | private CommonDencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static int textLength(DencodeCondition cond) { 33 | return getTextLength(cond.value()); 34 | } 35 | 36 | @DencoderFunction 37 | public static int textByteLength(DencodeCondition cond) { 38 | return getTextByteLength(cond.valueAsBinary()); 39 | } 40 | 41 | 42 | private static int getTextLength(String val) { 43 | if (val == null || val.isEmpty()) { 44 | return 0; 45 | } 46 | 47 | return val.codePointCount(0, val.length()); 48 | } 49 | 50 | private static int getTextByteLength(byte[] binValue) { 51 | return binValue.length; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/DateAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="date", method="date.all", hasEncoder=true, hasDecoder=false, useTz=true) 22 | public class DateAllDencoder { 23 | 24 | private DateAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/DateCTimeDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.time.ZonedDateTime; 20 | import java.time.format.DateTimeFormatter; 21 | import java.util.List; 22 | import java.util.Locale; 23 | 24 | import com.dencode.logic.dencoder.annotation.Dencoder; 25 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 26 | import com.dencode.logic.model.DencodeCondition; 27 | 28 | @Dencoder(type="date", method="date.ctime", hasEncoder=true, hasDecoder=false, useTz=true) 29 | public class DateCTimeDencoder { 30 | 31 | private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss uuuu", Locale.US); 32 | 33 | private DateCTimeDencoder() { 34 | // NOP 35 | } 36 | 37 | 38 | @DencoderFunction 39 | public static String encDateCTime(DencodeCondition cond) { 40 | return encDateCTime(cond.valueAsDates()); 41 | } 42 | 43 | 44 | private static String encDateCTime(List vals) { 45 | return DencodeUtils.dencodeLines(vals, (dateVal) -> { 46 | if (dateVal == null) { 47 | return null; 48 | } 49 | 50 | return FORMATTER.format(dateVal); 51 | }); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/DateRFC2822Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.time.ZoneId; 20 | import java.time.ZonedDateTime; 21 | import java.time.format.DateTimeFormatter; 22 | import java.util.List; 23 | import java.util.Locale; 24 | 25 | import com.dencode.logic.dencoder.annotation.Dencoder; 26 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 27 | import com.dencode.logic.model.DencodeCondition; 28 | 29 | @Dencoder(type="date", method="date.rfc2822", hasEncoder=true, hasDecoder=false, useTz=true) 30 | public class DateRFC2822Dencoder { 31 | 32 | private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("EEE, dd MMM uuuu HH:mm:ss zzz", Locale.US); 33 | 34 | private DateRFC2822Dencoder() { 35 | // NOP 36 | } 37 | 38 | 39 | @DencoderFunction 40 | public static String encDateRFC2822(DencodeCondition cond) { 41 | return encDateRFC2822(cond.valueAsDates()); 42 | } 43 | 44 | 45 | private static String encDateRFC2822(List vals) { 46 | return DencodeUtils.dencodeLines(vals, (dateVal) -> { 47 | if (dateVal == null) { 48 | return null; 49 | } 50 | 51 | if (dateVal.getZone().getId().equals("UTC")) { 52 | dateVal = dateVal.withZoneSameInstant(ZoneId.of("GMT")); 53 | } 54 | 55 | return FORMATTER.format(dateVal); 56 | }); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/DateUnixTimeDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.time.Instant; 21 | import java.time.ZonedDateTime; 22 | import java.util.List; 23 | 24 | import com.dencode.logic.dencoder.annotation.Dencoder; 25 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 26 | import com.dencode.logic.model.DencodeCondition; 27 | 28 | @Dencoder(type="date", method="date.unix-time", hasEncoder=true, hasDecoder=false, useTz=true) 29 | public class DateUnixTimeDencoder { 30 | 31 | private DateUnixTimeDencoder() { 32 | // NOP 33 | } 34 | 35 | 36 | @DencoderFunction 37 | public static String encDateUnixTime(DencodeCondition cond) { 38 | return encDateUnixTime(cond.valueAsDates()); 39 | } 40 | 41 | 42 | private static String encDateUnixTime(List vals) { 43 | return DencodeUtils.dencodeLines(vals, (dateVal) -> { 44 | if (dateVal == null) { 45 | return null; 46 | } 47 | 48 | try { 49 | Instant instant = dateVal.toInstant(); 50 | long epochSecPart = instant.getEpochSecond(); 51 | long epochNanosecPart = instant.getNano(); 52 | 53 | if (epochNanosecPart == 0) { 54 | return Long.toString(epochSecPart); 55 | } else { 56 | BigDecimal epochSec = BigDecimal.valueOf(epochSecPart).add(BigDecimal.valueOf(epochNanosecPart, 9)).stripTrailingZeros(); 57 | return epochSec.toPlainString(); 58 | } 59 | } catch (ArithmeticException e) { 60 | return null; 61 | } 62 | }); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/DateW3CDTFDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.time.ZonedDateTime; 20 | import java.time.format.DateTimeFormatter; 21 | import java.util.List; 22 | import java.util.Locale; 23 | 24 | import com.dencode.logic.dencoder.annotation.Dencoder; 25 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 26 | import com.dencode.logic.model.DencodeCondition; 27 | 28 | @Dencoder(type="date", method="date.w3cdtf", hasEncoder=true, hasDecoder=false, useTz=true) 29 | public class DateW3CDTFDencoder { 30 | 31 | private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ssXXX", Locale.US); 32 | private static final DateTimeFormatter FORMATTER_MSEC = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss.SSSXXX", Locale.US); 33 | private static final DateTimeFormatter FORMATTER_MICROSEC = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXX", Locale.US); 34 | private static final DateTimeFormatter FORMATTER_NSEC = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXX", Locale.US); 35 | 36 | private DateW3CDTFDencoder() { 37 | // NOP 38 | } 39 | 40 | 41 | @DencoderFunction 42 | public static String encDateW3CDTF(DencodeCondition cond) { 43 | return encDateW3CDTF(cond.valueAsDates()); 44 | } 45 | 46 | 47 | private static String encDateW3CDTF(List vals) { 48 | return DencodeUtils.dencodeLines(vals, (dateVal) -> { 49 | return DencodeUtils.encDate(dateVal, FORMATTER, FORMATTER_MSEC, FORMATTER_MICROSEC, FORMATTER_NSEC); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="hash", method="hash.all", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 22 | public class HashAllDencoder { 23 | 24 | private HashAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashCRC32Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.zip.CRC32; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | 25 | @Dencoder(type="hash", method="hash.crc32", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 26 | public class HashCRC32Dencoder { 27 | 28 | private HashCRC32Dencoder() { 29 | // NOP 30 | } 31 | 32 | 33 | @DencoderFunction 34 | public static String encHashCRC32(DencodeCondition cond) { 35 | return encHashCRC32(cond.valueAsBinary()); 36 | } 37 | 38 | 39 | private static String encHashCRC32(byte[] binValue) { 40 | CRC32 crc = new CRC32(); 41 | crc.update(binValue, 0, binValue.length); 42 | return Long.toHexString(crc.getValue()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashMD2Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="hash", method="hash.md2", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 24 | public class HashMD2Dencoder { 25 | 26 | private HashMD2Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encHashMD2(DencodeCondition cond) { 33 | return DencodeUtils.encHash(cond.valueAsBinary(), "MD2"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashMD5Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="hash", method="hash.md5", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 24 | public class HashMD5Dencoder { 25 | 26 | private HashMD5Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encHashMD5(DencodeCondition cond) { 33 | return DencodeUtils.encHash(cond.valueAsBinary(), "MD5"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashSHA1Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="hash", method="hash.sha1", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 24 | public class HashSHA1Dencoder { 25 | 26 | private HashSHA1Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encHashSHA1(DencodeCondition cond) { 33 | return DencodeUtils.encHash(cond.valueAsBinary(), "SHA-1"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashSHA256Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="hash", method="hash.sha256", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 24 | public class HashSHA256Dencoder { 25 | 26 | private HashSHA256Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encHashSHA256(DencodeCondition cond) { 33 | return DencodeUtils.encHash(cond.valueAsBinary(), "SHA-256"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashSHA384Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="hash", method="hash.sha384", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 24 | public class HashSHA384Dencoder { 25 | 26 | private HashSHA384Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encHashSHA384(DencodeCondition cond) { 33 | return DencodeUtils.encHash(cond.valueAsBinary(), "SHA-384"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/HashSHA512Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="hash", method="hash.sha512", hasEncoder=true, hasDecoder=false, useOe=true, useNl=true) 24 | public class HashSHA512Dencoder { 25 | 26 | private HashSHA512Dencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encHashSHA512(DencodeCondition cond) { 33 | return DencodeUtils.encHash(cond.valueAsBinary(), "SHA-512"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="number", method="number.all", hasEncoder=true, hasDecoder=true) 22 | public class NumberAllDencoder { 23 | 24 | private NumberAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberBinDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.util.List; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | import com.dencode.logic.parser.NumberParser; 26 | 27 | @Dencoder(type="number", method="number.bin", hasEncoder=true, hasDecoder=true) 28 | public class NumberBinDencoder { 29 | 30 | private static final int DEC_RADIX = 10; 31 | private static final int DEC_MAX_SCALE = 100; 32 | 33 | private static final int ENC_RADIX = 2; 34 | private static final int ENC_MAX_SCALE = DencodeUtils.digitsOf(DEC_MAX_SCALE, ENC_RADIX); 35 | 36 | private static final int MAX_REPETEND_COUNT = 3; 37 | 38 | private NumberBinDencoder() { 39 | // NOP 40 | } 41 | 42 | 43 | @DencoderFunction 44 | public static String encNumBin(DencodeCondition cond) { 45 | return encNumBin(cond.valueAsNumbers(), cond.valueAsLines()); 46 | } 47 | 48 | @DencoderFunction 49 | public static String decNumBin(DencodeCondition cond) { 50 | return decNumBin(cond.valueAsLines()); 51 | } 52 | 53 | 54 | private static String encNumBin(List vals, List strVals) { 55 | return DencodeUtils.dencodeLines(vals, strVals, (bigDec, strVal) -> { 56 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(strVal), ENC_RADIX, ENC_MAX_SCALE, MAX_REPETEND_COUNT); 57 | }); 58 | } 59 | 60 | private static String decNumBin(List vals) { 61 | return DencodeUtils.dencodeLines(vals, (val) -> { 62 | BigDecimal bigDec = NumberParser.parseN(val, ENC_RADIX); 63 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(val), DEC_RADIX, DEC_MAX_SCALE, MAX_REPETEND_COUNT); 64 | }); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberDecDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.util.List; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | import com.dencode.logic.parser.NumberParser; 26 | 27 | @Dencoder(type="number", method="number.dec", hasEncoder=true, hasDecoder=true) 28 | public class NumberDecDencoder { 29 | 30 | private static final int DEC_RADIX = 10; 31 | private static final int DEC_MAX_SCALE = 100; 32 | 33 | private static final int ENC_RADIX = 10; 34 | private static final int ENC_MAX_SCALE = DEC_MAX_SCALE; 35 | 36 | private static final int MAX_REPETEND_COUNT = 3; 37 | 38 | private NumberDecDencoder() { 39 | // NOP 40 | } 41 | 42 | 43 | @DencoderFunction 44 | public static String encNumDec(DencodeCondition cond) { 45 | return encNumDec(cond.valueAsNumbers(), cond.valueAsLines()); 46 | } 47 | 48 | @DencoderFunction 49 | public static String decNumDec(DencodeCondition cond) { 50 | return decNumDec(cond.valueAsLines()); 51 | } 52 | 53 | 54 | private static String encNumDec(List vals, List strVals) { 55 | return DencodeUtils.dencodeLines(vals, strVals, (bigDec, strVal) -> { 56 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(strVal), ENC_RADIX, ENC_MAX_SCALE, MAX_REPETEND_COUNT); 57 | }); 58 | } 59 | 60 | private static String decNumDec(List vals) { 61 | return DencodeUtils.dencodeLines(vals, (val) -> { 62 | BigDecimal bigDec = NumberParser.parseDec(val); 63 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(val), DEC_RADIX, DEC_MAX_SCALE, MAX_REPETEND_COUNT); 64 | }); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberFractionDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.math.BigInteger; 21 | import java.util.List; 22 | 23 | import com.dencode.logic.dencoder.annotation.Dencoder; 24 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 25 | import com.dencode.logic.model.DencodeCondition; 26 | import com.dencode.logic.parser.NumberParser; 27 | 28 | @Dencoder(type="number", method="number.fraction", hasEncoder=true, hasDecoder=false) 29 | public class NumberFractionDencoder { 30 | 31 | private NumberFractionDencoder() { 32 | // NOP 33 | } 34 | 35 | 36 | @DencoderFunction 37 | public static String encNumFraction(DencodeCondition cond) { 38 | return encNumFraction(cond.valueAsNumbers(), cond.valueAsLines()); 39 | } 40 | 41 | 42 | private static String encNumFraction(List vals, List strVals) { 43 | return DencodeUtils.dencodeLines(vals, strVals, (bigDec, strVal) -> { 44 | if (bigDec == null) { 45 | return null; 46 | } 47 | 48 | BigDecimal strippedNum = bigDec.stripTrailingZeros(); 49 | if (strippedNum.scale() <= 0) { 50 | // Has no decimal part 51 | // (Integer part only) 52 | return strippedNum.toPlainString() + "/1"; 53 | } 54 | 55 | // n/d 56 | BigInteger[] fraction = NumberParser.parseFraction(strVal, 10); 57 | if (fraction == null) { 58 | // n.nnn 59 | fraction = NumberParser.toFraction(bigDec, NumberParser.isTruncatedDecimal(strVal)); 60 | if (fraction == null) { 61 | return null; 62 | } 63 | } 64 | 65 | fraction = NumberParser.reduceFraction(fraction); 66 | 67 | BigInteger n = fraction[0]; 68 | BigInteger d = fraction[1]; 69 | 70 | if (d.signum() == 0) { 71 | return null; 72 | } 73 | 74 | if (d.signum() == -1) { 75 | // n/-d to -n/d 76 | n = n.negate(); 77 | d = d.abs(); 78 | } 79 | 80 | return n.toString() + "/" + d.toString(); 81 | }); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberHexDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.util.List; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | import com.dencode.logic.parser.NumberParser; 26 | 27 | @Dencoder(type="number", method="number.hex", hasEncoder=true, hasDecoder=true) 28 | public class NumberHexDencoder { 29 | 30 | private static final int DEC_RADIX = 10; 31 | private static final int DEC_MAX_SCALE = 100; 32 | 33 | private static final int ENC_RADIX = 16; 34 | private static final int ENC_MAX_SCALE = DencodeUtils.digitsOf(DEC_MAX_SCALE, ENC_RADIX); 35 | 36 | private static final int MAX_REPETEND_COUNT = 3; 37 | 38 | private NumberHexDencoder() { 39 | // NOP 40 | } 41 | 42 | 43 | @DencoderFunction 44 | public static String encNumHex(DencodeCondition cond) { 45 | return encNumHex(cond.valueAsNumbers(), cond.valueAsLines()); 46 | } 47 | 48 | @DencoderFunction 49 | public static String decNumHex(DencodeCondition cond) { 50 | return decNumHex(cond.valueAsLines()); 51 | } 52 | 53 | 54 | private static String encNumHex(List vals, List strVals) { 55 | return DencodeUtils.dencodeLines(vals, strVals, (bigDec, strVal) -> { 56 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(strVal), ENC_RADIX, ENC_MAX_SCALE, MAX_REPETEND_COUNT); 57 | }); 58 | } 59 | 60 | private static String decNumHex(List vals) { 61 | return DencodeUtils.dencodeLines(vals, (val) -> { 62 | BigDecimal bigDec = NumberParser.parseN(val, ENC_RADIX); 63 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(val), DEC_RADIX, DEC_MAX_SCALE, MAX_REPETEND_COUNT); 64 | }); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberJapaneseDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.util.List; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | import com.dencode.logic.util.JapaneseNumberUtils; 26 | 27 | @Dencoder(type="number", method="number.japanese", hasEncoder=true, hasDecoder=true) 28 | public class NumberJapaneseDencoder { 29 | 30 | private NumberJapaneseDencoder() { 31 | // NOP 32 | } 33 | 34 | 35 | @DencoderFunction 36 | public static String encNumJP(DencodeCondition cond) { 37 | return encNumJP(cond.valueAsNumbers()); 38 | } 39 | 40 | @DencoderFunction 41 | public static String encNumJPDaiji(DencodeCondition cond) { 42 | return encNumJPDaiji(cond.valueAsNumbers()); 43 | } 44 | 45 | @DencoderFunction 46 | public static String decNumJP(DencodeCondition cond) { 47 | return decNumJP(cond.valueAsLines()); 48 | } 49 | 50 | 51 | private static String encNumJP(List vals) { 52 | return DencodeUtils.dencodeLines(vals, (bigDec) -> { 53 | if (bigDec == null) { 54 | return null; 55 | } 56 | 57 | try { 58 | return JapaneseNumberUtils.toJPNum(bigDec, false, false, false); 59 | } catch (IllegalArgumentException e) { 60 | return null; 61 | } 62 | }); 63 | } 64 | 65 | private static String encNumJPDaiji(List vals) { 66 | return DencodeUtils.dencodeLines(vals, (bigDec) -> { 67 | if (bigDec == null) { 68 | return null; 69 | } 70 | 71 | try { 72 | return JapaneseNumberUtils.toJPNum(bigDec, true, true, false); 73 | } catch (IllegalArgumentException e) { 74 | return null; 75 | } 76 | }); 77 | } 78 | 79 | private static String decNumJP(List vals) { 80 | return DencodeUtils.dencodeLines(vals, (val) -> { 81 | BigDecimal bigDec; 82 | try { 83 | bigDec = JapaneseNumberUtils.parseJPNum(val); 84 | } catch (IllegalArgumentException e) { 85 | return null; 86 | } 87 | 88 | if (bigDec == null) { 89 | return null; 90 | } 91 | return bigDec.toPlainString(); 92 | }); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/NumberOctDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.math.BigDecimal; 20 | import java.util.List; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | import com.dencode.logic.parser.NumberParser; 26 | 27 | @Dencoder(type="number", method="number.oct", hasEncoder=true, hasDecoder=true) 28 | public class NumberOctDencoder { 29 | 30 | private static final int DEC_RADIX = 10; 31 | private static final int DEC_MAX_SCALE = 100; 32 | 33 | private static final int ENC_RADIX = 8; 34 | private static final int ENC_MAX_SCALE = DencodeUtils.digitsOf(DEC_MAX_SCALE, ENC_RADIX); 35 | 36 | private static final int MAX_REPETEND_COUNT = 3; 37 | 38 | private NumberOctDencoder() { 39 | // NOP 40 | } 41 | 42 | 43 | @DencoderFunction 44 | public static String encNumOct(DencodeCondition cond) { 45 | return encNumOct(cond.valueAsNumbers(), cond.valueAsLines()); 46 | } 47 | 48 | @DencoderFunction 49 | public static String decNumOct(DencodeCondition cond) { 50 | return decNumOct(cond.valueAsLines()); 51 | } 52 | 53 | 54 | private static String encNumOct(List vals, List strVals) { 55 | return DencodeUtils.dencodeLines(vals, strVals, (bigDec, strVal) -> { 56 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(strVal), ENC_RADIX, ENC_MAX_SCALE, MAX_REPETEND_COUNT); 57 | }); 58 | } 59 | 60 | private static String decNumOct(List vals) { 61 | return DencodeUtils.dencodeLines(vals, (val) -> { 62 | BigDecimal bigDec = NumberParser.parseN(val, ENC_RADIX); 63 | return DencodeUtils.numToString(bigDec, NumberParser.isTruncatedDecimal(val), DEC_RADIX, DEC_MAX_SCALE, MAX_REPETEND_COUNT); 64 | }); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringAllDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | 21 | @Dencoder(type="string", method="string.all", hasEncoder=true, hasDecoder=true, useOe=true, useNl=true) 22 | public class StringAllDencoder { 23 | 24 | private StringAllDencoder() { 25 | // NOP 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringCamelCaseDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.List; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | 25 | @Dencoder(type="string", method="string.camel-case", hasEncoder=true, hasDecoder=false) 26 | public class StringCamelCaseDencoder { 27 | 28 | private StringCamelCaseDencoder() { 29 | // NOP 30 | } 31 | 32 | 33 | @DencoderFunction 34 | public static String encStrUpperCamelCase(DencodeCondition cond) { 35 | return encStrCamelCase(cond.valueAsLines(), true); 36 | } 37 | 38 | @DencoderFunction 39 | public static String encStrLowerCamelCase(DencodeCondition cond) { 40 | return encStrCamelCase(cond.valueAsLines(), false); 41 | } 42 | 43 | 44 | private static String encStrCamelCase(List vals, boolean firstCapital) { 45 | return DencodeUtils.dencodeLines(vals, (val) -> DencodeUtils.changeSeparator(val, -1, Character::toLowerCase, Character::toUpperCase, (firstCapital) ? Character::toUpperCase : Character::toLowerCase)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringCharacterWidthDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | import com.dencode.logic.util.CharWidthUtils; 23 | 24 | @Dencoder(type="string", method="string.character-width", hasEncoder=true, hasDecoder=false) 25 | public class StringCharacterWidthDencoder { 26 | 27 | private StringCharacterWidthDencoder() { 28 | // NOP 29 | } 30 | 31 | 32 | @DencoderFunction 33 | public static String encStrHalfWidth(DencodeCondition cond) { 34 | return encStrHalfWidth(cond.value()); 35 | } 36 | 37 | @DencoderFunction 38 | public static String encStrFullWidth(DencodeCondition cond) { 39 | return encStrFullWidth(cond.value()); 40 | } 41 | 42 | 43 | private static String encStrHalfWidth(String val) { 44 | return CharWidthUtils.toHalfWidth(val); 45 | } 46 | 47 | private static String encStrFullWidth(String val) { 48 | return CharWidthUtils.toFullWidth(val); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringKebabCaseDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.List; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | 25 | @Dencoder(type="string", method="string.kebab-case", hasEncoder=true, hasDecoder=false) 26 | public class StringKebabCaseDencoder { 27 | 28 | private StringKebabCaseDencoder() { 29 | // NOP 30 | } 31 | 32 | 33 | @DencoderFunction 34 | public static String encStrUpperKebabCase(DencodeCondition cond) { 35 | return encStrKebabCase(cond.valueAsLines(), true); 36 | } 37 | 38 | @DencoderFunction 39 | public static String encStrLowerKebabCase(DencodeCondition cond) { 40 | return encStrKebabCase(cond.valueAsLines(), false); 41 | } 42 | 43 | 44 | private static String encStrKebabCase(List vals, boolean upper) { 45 | return DencodeUtils.dencodeLines(vals, (val) -> DencodeUtils.changeSeparator(val, '-', (upper) ? Character::toUpperCase : Character::toLowerCase, null, null)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringLineSortDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Collections; 21 | import java.util.List; 22 | import java.util.stream.Collectors; 23 | 24 | import com.dencode.logic.dencoder.annotation.Dencoder; 25 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 26 | import com.dencode.logic.model.DencodeCondition; 27 | 28 | @Dencoder(type="string", method="string.line-sort", hasEncoder=true, hasDecoder=false) 29 | public class StringLineSortDencoder { 30 | 31 | private StringLineSortDencoder() { 32 | // NOP 33 | } 34 | 35 | 36 | @DencoderFunction 37 | public static String encStrLineSort(DencodeCondition cond) { 38 | return encStrLineSort( 39 | cond.valueAsLines(), 40 | DencodeUtils.getOption(cond.options(), "string.line-sort.order", "asc") 41 | ); 42 | } 43 | 44 | 45 | private static String encStrLineSort(List varLines, String order) { 46 | switch (order) { 47 | case "desc": return encStrLineSortDesc(varLines); 48 | case "reverse": return encStrLineSortReverse(varLines); 49 | default: return encStrLineSortAsc(varLines); 50 | } 51 | } 52 | 53 | private static String encStrLineSortAsc(List varLines) { 54 | return varLines.stream() 55 | .sorted() 56 | .collect(Collectors.joining("\n")); 57 | } 58 | 59 | private static String encStrLineSortDesc(List varLines) { 60 | return varLines.stream() 61 | .sorted(Collections.reverseOrder()) 62 | .collect(Collectors.joining("\n")); 63 | } 64 | 65 | private static String encStrLineSortReverse(List varLines) { 66 | List list = new ArrayList<>(varLines); 67 | Collections.reverse(list); 68 | return list.stream() 69 | .collect(Collectors.joining("\n")); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringLineUniqueDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.List; 20 | import java.util.stream.Collectors; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | 26 | @Dencoder(type="string", method="string.line-unique", hasEncoder=true, hasDecoder=false) 27 | public class StringLineUniqueDencoder { 28 | 29 | private StringLineUniqueDencoder() { 30 | // NOP 31 | } 32 | 33 | 34 | @DencoderFunction 35 | public static String encStrLineUnique(DencodeCondition cond) { 36 | return encStrLineUnique(cond.valueAsLines()); 37 | } 38 | 39 | 40 | private static String encStrLineUnique(List varLines) { 41 | return varLines.stream() 42 | .distinct() 43 | .collect(Collectors.joining("\n")); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringNamingConventionDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="string", method="string.naming-convention", hasEncoder=true, hasDecoder=false) 24 | public class StringNamingConventionDencoder { 25 | 26 | private StringNamingConventionDencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encStrUpperCamelCase(DencodeCondition cond) { 33 | return StringCamelCaseDencoder.encStrUpperCamelCase(cond); 34 | } 35 | 36 | @DencoderFunction 37 | public static String encStrLowerCamelCase(DencodeCondition cond) { 38 | return StringCamelCaseDencoder.encStrLowerCamelCase(cond); 39 | } 40 | 41 | @DencoderFunction 42 | public static String encStrUpperSnakeCase(DencodeCondition cond) { 43 | return StringSnakeCaseDencoder.encStrUpperSnakeCase(cond); 44 | } 45 | 46 | @DencoderFunction 47 | public static String encStrLowerSnakeCase(DencodeCondition cond) { 48 | return StringSnakeCaseDencoder.encStrLowerSnakeCase(cond); 49 | } 50 | 51 | @DencoderFunction 52 | public static String encStrUpperKebabCase(DencodeCondition cond) { 53 | return StringKebabCaseDencoder.encStrUpperKebabCase(cond); 54 | } 55 | 56 | @DencoderFunction 57 | public static String encStrLowerKebabCase(DencodeCondition cond) { 58 | return StringKebabCaseDencoder.encStrLowerKebabCase(cond); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringPunycodeDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.net.IDN; 20 | import java.util.List; 21 | 22 | import com.dencode.logic.dencoder.annotation.Dencoder; 23 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 24 | import com.dencode.logic.model.DencodeCondition; 25 | 26 | @Dencoder(type="string", method="string.punycode", hasEncoder=true, hasDecoder=true) 27 | public class StringPunycodeDencoder { 28 | 29 | private StringPunycodeDencoder() { 30 | // NOP 31 | } 32 | 33 | 34 | @DencoderFunction 35 | public static String encStrPunycode(DencodeCondition cond) { 36 | return encStrPunycode(cond.valueAsLines()); 37 | } 38 | 39 | @DencoderFunction 40 | public static String decStrPunycode(DencodeCondition cond) { 41 | return decStrPunycode(cond.valueAsLines()); 42 | } 43 | 44 | 45 | private static String encStrPunycode(List vals) { 46 | try { 47 | return DencodeUtils.dencodeLines(vals, (val) -> IDN.toASCII(val, IDN.ALLOW_UNASSIGNED)); 48 | } catch (IllegalArgumentException e) { 49 | return null; 50 | } catch (RuntimeException e) { 51 | // Handle "input too long: XXXX UTF-16 code units at java.base/jdk.internal.icu" exception for Java21 52 | return null; 53 | } 54 | } 55 | 56 | private static String decStrPunycode(List vals) { 57 | return DencodeUtils.dencodeLines(vals, (val) -> IDN.toUnicode(val, IDN.ALLOW_UNASSIGNED)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringSnakeCaseDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.List; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | 25 | @Dencoder(type="string", method="string.snake-case", hasEncoder=true, hasDecoder=false) 26 | public class StringSnakeCaseDencoder { 27 | 28 | private StringSnakeCaseDencoder() { 29 | // NOP 30 | } 31 | 32 | 33 | @DencoderFunction 34 | public static String encStrUpperSnakeCase(DencodeCondition cond) { 35 | return encStrSnakeCase(cond.valueAsLines(), true); 36 | } 37 | 38 | @DencoderFunction 39 | public static String encStrLowerSnakeCase(DencodeCondition cond) { 40 | return encStrSnakeCase(cond.valueAsLines(), false); 41 | } 42 | 43 | private static String encStrSnakeCase(List vals, boolean upper) { 44 | return DencodeUtils.dencodeLines(vals, (val) -> DencodeUtils.changeSeparator(val, '_', (upper) ? Character::toUpperCase : Character::toLowerCase, null, null)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringTextInitialsDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.util.List; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | 25 | @Dencoder(type="string", method="string.text-initials", hasEncoder=true, hasDecoder=false) 26 | public class StringTextInitialsDencoder { 27 | 28 | private StringTextInitialsDencoder() { 29 | // NOP 30 | } 31 | 32 | 33 | @DencoderFunction 34 | public static String encStrInitials(DencodeCondition cond) { 35 | return encStrInitials(cond.valueAsLines()); 36 | } 37 | 38 | 39 | private static String encStrInitials(List vals) { 40 | return DencodeUtils.dencodeLines(vals, (val) -> initials(val)); 41 | } 42 | 43 | private static String initials(String str) { 44 | if (str == null || str.isEmpty()) { 45 | return str; 46 | } 47 | 48 | boolean first = true; 49 | int len = str.length(); 50 | StringBuilder sb = new StringBuilder(len / 2 + 1); 51 | for (int i = 0; i < len; ) { 52 | int cp = str.codePointAt(i); 53 | 54 | boolean nextFirst = Character.isWhitespace(cp); 55 | 56 | if (first && !nextFirst) { 57 | sb.appendCodePoint(cp); 58 | } 59 | 60 | first = nextFirst; 61 | i += Character.charCount(cp); 62 | } 63 | 64 | return sb.toString(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringTextReverseDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import com.dencode.logic.dencoder.annotation.Dencoder; 20 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 21 | import com.dencode.logic.model.DencodeCondition; 22 | 23 | @Dencoder(type="string", method="string.text-reverse", hasEncoder=true, hasDecoder=false) 24 | public class StringTextReverseDencoder { 25 | 26 | private StringTextReverseDencoder() { 27 | // NOP 28 | } 29 | 30 | 31 | @DencoderFunction 32 | public static String encStrReverse(DencodeCondition cond) { 33 | return encStrReverse(cond.value()); 34 | } 35 | 36 | 37 | private static String encStrReverse(String val) { 38 | if (val == null || val.length() <= 1) { 39 | return val; 40 | } 41 | 42 | return new StringBuilder(val).reverse().toString(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/StringUnicodeNormalizationDencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder; 18 | 19 | import java.text.Normalizer; 20 | 21 | import com.dencode.logic.dencoder.annotation.Dencoder; 22 | import com.dencode.logic.dencoder.annotation.DencoderFunction; 23 | import com.dencode.logic.model.DencodeCondition; 24 | 25 | @Dencoder(type="string", method="string.unicode-normalization", hasEncoder=true, hasDecoder=true) 26 | public class StringUnicodeNormalizationDencoder { 27 | 28 | private StringUnicodeNormalizationDencoder() { 29 | // NOP 30 | } 31 | 32 | 33 | @DencoderFunction 34 | public static String encStrUnicodeNFC(DencodeCondition cond) { 35 | return encStrUnicodeNFC(cond.value()); 36 | } 37 | 38 | @DencoderFunction 39 | public static String encStrUnicodeNFKC(DencodeCondition cond) { 40 | return encStrUnicodeNFKC(cond.value()); 41 | } 42 | 43 | @DencoderFunction 44 | public static String decStrUnicodeNFC(DencodeCondition cond) { 45 | return decStrUnicodeNFC(cond.value()); 46 | } 47 | 48 | @DencoderFunction 49 | public static String decStrUnicodeNFKC(DencodeCondition cond) { 50 | return decStrUnicodeNFKC(cond.value()); 51 | } 52 | 53 | 54 | private static String encStrUnicodeNFC(String val) { 55 | return Normalizer.normalize(val, Normalizer.Form.NFC); 56 | } 57 | 58 | private static String encStrUnicodeNFKC(String val) { 59 | return Normalizer.normalize(val, Normalizer.Form.NFKC); 60 | } 61 | 62 | private static String decStrUnicodeNFC(String val) { 63 | return Normalizer.normalize(val, Normalizer.Form.NFD); 64 | } 65 | 66 | private static String decStrUnicodeNFKC(String val) { 67 | return Normalizer.normalize(val, Normalizer.Form.NFKD); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/annotation/Dencoder.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @Target(ElementType.TYPE) 26 | public @interface Dencoder { 27 | /** Dencode type */ 28 | String type(); 29 | 30 | /** Dencode method */ 31 | String method(); 32 | 33 | /** true if has encoder functions */ 34 | boolean hasEncoder(); 35 | 36 | /** true if has decoder functions */ 37 | boolean hasDecoder(); 38 | 39 | /** true if uses "oe" output-encoding parameter */ 40 | boolean useOe() default false; 41 | 42 | /** true if uses "nl" new-line parameter */ 43 | boolean useNl() default false; 44 | 45 | /** true if uses "tz" time-zone parameter */ 46 | boolean useTz() default false; 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/logic/dencoder/annotation/DencoderFunction.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.logic.dencoder.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @Target(ElementType.METHOD) 26 | public @interface DencoderFunction { 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/model/Message.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.model; 18 | 19 | public class Message { 20 | 21 | private String messageId; 22 | private String level; 23 | private String message; 24 | private String detail; 25 | 26 | public Message() { 27 | this(null, null, null, null); 28 | } 29 | 30 | public Message(String messageId, String level, String message, String detail) { 31 | this.messageId = messageId; 32 | this.level = level; 33 | this.message = message; 34 | this.detail = detail; 35 | } 36 | 37 | public String getMessageId() { 38 | return messageId; 39 | } 40 | 41 | public void setMessageId(String messageId) { 42 | this.messageId = messageId; 43 | } 44 | public String getLevel() { 45 | return level; 46 | } 47 | 48 | public void setLevel(String level) { 49 | this.level = level; 50 | } 51 | 52 | public String getMessage() { 53 | return message; 54 | } 55 | 56 | public void setMessage(String message) { 57 | this.message = message; 58 | } 59 | 60 | public String getDetail() { 61 | return detail; 62 | } 63 | 64 | public void setDetail(String detail) { 65 | this.detail = detail; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "messageId=" + this.messageId 71 | + ", level=" + this.level 72 | + ", message=" + this.message 73 | + ", detail=" + this.detail; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/model/ResponseModel.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.model; 18 | 19 | import java.util.List; 20 | 21 | public class ResponseModel { 22 | private int statusCode; 23 | private List messages; 24 | private String redirectUrl; 25 | private Object response; 26 | 27 | public int getStatusCode() { 28 | return statusCode; 29 | } 30 | public void setStatusCode(int statusCode) { 31 | this.statusCode = statusCode; 32 | } 33 | public List getMessages() { 34 | return messages; 35 | } 36 | public void setMessages(List messages) { 37 | this.messages = messages; 38 | } 39 | public String getRedirectUrl() { 40 | return redirectUrl; 41 | } 42 | public void setRedirectUrl(String redirectUrl) { 43 | this.redirectUrl = redirectUrl; 44 | } 45 | public Object getResponse() { 46 | return response; 47 | } 48 | public void setResponse(Object response) { 49 | this.response = response; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/server/ServerMain.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.server; 18 | 19 | import java.io.File; 20 | 21 | import org.eclipse.jetty.ee10.webapp.WebAppContext; 22 | import org.eclipse.jetty.server.Server; 23 | 24 | public class ServerMain { 25 | 26 | public static void main(String[] args) throws Exception { 27 | int port = Integer.parseInt(System.getenv().getOrDefault("PORT", "8080")); 28 | File warFile = new File(".").getCanonicalFile().listFiles((dir, name) -> name.endsWith(".war"))[0]; 29 | 30 | WebAppContext webAppContext = new WebAppContext(); 31 | webAppContext.setContextPath("/"); 32 | webAppContext.setWar(warFile.getPath()); 33 | webAppContext.getSessionHandler().setUsingCookies(false); 34 | 35 | Server server = new Server(port); 36 | server.setHandler(webAppContext); 37 | 38 | server.start(); 39 | server.join(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/filter/RootCharacterEncodingFilter.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.filter; 18 | 19 | import java.io.IOException; 20 | 21 | import jakarta.servlet.Filter; 22 | import jakarta.servlet.FilterChain; 23 | import jakarta.servlet.FilterConfig; 24 | import jakarta.servlet.ServletException; 25 | import jakarta.servlet.ServletRequest; 26 | import jakarta.servlet.ServletResponse; 27 | import jakarta.servlet.annotation.WebFilter; 28 | 29 | @WebFilter(urlPatterns = "/*") 30 | public class RootCharacterEncodingFilter implements Filter { 31 | 32 | private static String CHARSET = "UTF-8"; 33 | 34 | public void init(FilterConfig config) throws ServletException { 35 | } 36 | 37 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { 38 | request.setCharacterEncoding(CHARSET); 39 | chain.doFilter(request,response); 40 | } 41 | 42 | public void destroy() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/filter/RootQuerySanitizationFilter.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.filter; 18 | 19 | import java.io.IOException; 20 | import java.util.regex.Pattern; 21 | 22 | import jakarta.servlet.Filter; 23 | import jakarta.servlet.FilterChain; 24 | import jakarta.servlet.FilterConfig; 25 | import jakarta.servlet.ServletException; 26 | import jakarta.servlet.ServletRequest; 27 | import jakarta.servlet.ServletResponse; 28 | import jakarta.servlet.annotation.WebFilter; 29 | import jakarta.servlet.http.HttpServletRequest; 30 | import jakarta.servlet.http.HttpServletResponse; 31 | 32 | @WebFilter(urlPatterns = "/*") 33 | public class RootQuerySanitizationFilter implements Filter { 34 | 35 | private static final Pattern ILLEGAL_PERCENT_QUERY = Pattern.compile("%(?=.?$|[^0-9A-Fa-f]|.[^0-9A-Fa-f])"); 36 | 37 | public void init(FilterConfig config) throws ServletException { 38 | } 39 | 40 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { 41 | if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) { 42 | HttpServletRequest req = (HttpServletRequest)request; 43 | HttpServletResponse res = (HttpServletResponse)response; 44 | 45 | String query = req.getQueryString(); 46 | 47 | if (query != null) { 48 | if (ILLEGAL_PERCENT_QUERY.matcher(query).find()) { 49 | // If the query has illegal percent-encoding 50 | 51 | // Escape all percent characters 52 | query = query.replace("%", "%25"); 53 | 54 | // Redirect with the sanitized query 55 | res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); 56 | res.setHeader("Location", req.getRequestURL() + "?" + query); 57 | return; 58 | } 59 | } 60 | } 61 | 62 | chain.doFilter(request, response); 63 | } 64 | 65 | public void destroy() { 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/PolicyServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages; 18 | 19 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 20 | 21 | import jakarta.servlet.annotation.WebServlet; 22 | 23 | @WebServlet("/policy") 24 | public class PolicyServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | redirect(reqres().request().getContextPath() + "/#policy"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/RootServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages; 18 | 19 | import java.util.List; 20 | import java.util.regex.Matcher; 21 | import java.util.regex.Pattern; 22 | 23 | import jakarta.servlet.annotation.WebServlet; 24 | 25 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 26 | 27 | @WebServlet("/") 28 | public class RootServlet extends AbstractDencodeHttpServlet { 29 | private static final long serialVersionUID = 1L; 30 | 31 | private static final Pattern LOCALE_PATH_PATTERN = Pattern.compile("/([a-z]{2}(?:\\-[A-Za-z]{2})?)/(.*)"); 32 | 33 | private static final List SUPPORTED_LOCALE_IDS = List.of(config().getString("locales").split(",")); 34 | 35 | @Override 36 | protected void doGet() throws Exception { 37 | String servletPath = reqres().request().getServletPath(); 38 | 39 | Matcher localePathMatcher = LOCALE_PATH_PATTERN.matcher(servletPath); 40 | if (localePathMatcher.matches()) { 41 | // Locale path 42 | String localeId = localePathMatcher.group(1); 43 | String subPath = localePathMatcher.group(2); 44 | 45 | if (SUPPORTED_LOCALE_IDS.contains(localeId)) { 46 | reqres().setAttribute("localeId", localeId); 47 | reqres().setAttribute("currentPath", subPath); 48 | 49 | forward("/" + subPath); 50 | return; 51 | } 52 | } 53 | 54 | // Forward to default servlet 55 | getServletContext().getNamedDispatcher("default").forward(reqres().request(), reqres().response()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/SitemapServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Collections; 21 | import java.util.List; 22 | 23 | import com.dencode.logic.DencodeMapper; 24 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 25 | 26 | import jakarta.servlet.annotation.WebServlet; 27 | 28 | @WebServlet("sitemap.xml") 29 | public class SitemapServlet extends AbstractDencodeHttpServlet { 30 | private static final long serialVersionUID = 1L; 31 | 32 | private static final List SUPPORTED_METHOD_PATHS; 33 | static { 34 | List types = DencodeMapper.getAllTypes(); 35 | List methods = DencodeMapper.getAllMethods(); 36 | 37 | List paths = new ArrayList<>(1 + types.size() + methods.size()); 38 | 39 | // Root paths 40 | paths.add(""); 41 | 42 | // Type paths 43 | for (String type : types) { 44 | paths.add(type); 45 | } 46 | 47 | // Method paths 48 | for (String method : methods) { 49 | paths.add(method.replace('.', '/')); 50 | } 51 | 52 | SUPPORTED_METHOD_PATHS = Collections.unmodifiableList(paths); 53 | } 54 | 55 | private static final List SUPPORTED_LOCALE_IDS = List.of(config().getString("locales").split(",")); 56 | 57 | @Override 58 | protected void doGet() throws Exception { 59 | 60 | reqres().setAttribute("supportedMethodPaths", SUPPORTED_METHOD_PATHS); 61 | reqres().setAttribute("supportedLocaleIDs", SUPPORTED_LOCALE_IDS); 62 | reqres().setAttribute("baseURL", getBaseURL(reqres())); 63 | 64 | forward("/WEB-INF/pages/sitemap.jsp"); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/_ah/WarmupServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages._ah; 18 | 19 | import java.util.Locale; 20 | import java.util.ResourceBundle; 21 | 22 | import jakarta.servlet.annotation.WebServlet; 23 | import jakarta.servlet.http.HttpServletResponse; 24 | 25 | import com.dencode.logic.DencodeMapper; 26 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 27 | 28 | @WebServlet("/_ah/warmup") 29 | public class WarmupServlet extends AbstractDencodeHttpServlet { 30 | private static final long serialVersionUID = 1L; 31 | 32 | @Override 33 | protected void doGet() throws Exception { 34 | // Warm up 35 | 36 | // Initialize DencodeMapper 37 | DencodeMapper.init(); 38 | 39 | // Cache messages 40 | String[] supportedLocaleIds = config().getString("locales").split(","); 41 | for (String id : supportedLocaleIds) { 42 | ResourceBundle.getBundle("messages", Locale.forLanguageTag(id)); 43 | } 44 | 45 | // Response 46 | HttpServletResponse res = response(); 47 | res.setStatus(HttpServletResponse.SC_OK); 48 | res.setHeader("Content-Type", "text/plain; charset=UTF-8"); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/cipher/CipherIndexServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.cipher; 18 | 19 | import jakarta.servlet.annotation.WebServlet; 20 | 21 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 22 | 23 | @WebServlet("/cipher/*") 24 | public class CipherIndexServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | String type = "cipher"; 30 | String method = "cipher." + reqres().pathParam("all"); 31 | 32 | reqres().setAttribute("type", type); 33 | reqres().setAttribute("method", method); 34 | 35 | if (reqres().attribute("currentPath") == null) { 36 | reqres().setAttribute("currentPath", getRequestSubPath(reqres())); 37 | } 38 | 39 | forward("/"); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/color/ColorIndexServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.color; 18 | 19 | import jakarta.servlet.annotation.WebServlet; 20 | 21 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 22 | 23 | @WebServlet("/color/*") 24 | public class ColorIndexServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | String type = "color"; 30 | String method = "color." + reqres().pathParam("all"); 31 | 32 | reqres().setAttribute("type", type); 33 | reqres().setAttribute("method", method); 34 | 35 | if (reqres().attribute("currentPath") == null) { 36 | reqres().setAttribute("currentPath", getRequestSubPath(reqres())); 37 | } 38 | 39 | forward("/"); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/date/DateIndexServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.date; 18 | 19 | import jakarta.servlet.annotation.WebServlet; 20 | 21 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 22 | 23 | @WebServlet("/date/*") 24 | public class DateIndexServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | String type = "date"; 30 | String method = "date." + reqres().pathParam("all"); 31 | 32 | reqres().setAttribute("type", type); 33 | reqres().setAttribute("method", method); 34 | 35 | if (reqres().attribute("currentPath") == null) { 36 | reqres().setAttribute("currentPath", getRequestSubPath(reqres())); 37 | } 38 | 39 | forward("/"); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/error/Error404Servlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.error; 18 | 19 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 20 | 21 | import jakarta.servlet.annotation.WebServlet; 22 | 23 | @WebServlet("/error/404") 24 | public class Error404Servlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | forward("/WEB-INF/pages/error/404.jsp"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/hash/HashIndexServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.hash; 18 | 19 | import jakarta.servlet.annotation.WebServlet; 20 | 21 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 22 | 23 | @WebServlet("/hash/*") 24 | public class HashIndexServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | String type = "hash"; 30 | String method = "hash." + reqres().pathParam("all"); 31 | 32 | reqres().setAttribute("type", type); 33 | reqres().setAttribute("method", method); 34 | 35 | if (reqres().attribute("currentPath") == null) { 36 | reqres().setAttribute("currentPath", getRequestSubPath(reqres())); 37 | } 38 | 39 | forward("/"); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/number/NumberIndexServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.number; 18 | 19 | import jakarta.servlet.annotation.WebServlet; 20 | 21 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 22 | 23 | @WebServlet("/number/*") 24 | public class NumberIndexServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | String type = "number"; 30 | String method = "number." + reqres().pathParam("all"); 31 | 32 | reqres().setAttribute("type", type); 33 | reqres().setAttribute("method", method); 34 | 35 | if (reqres().attribute("currentPath") == null) { 36 | reqres().setAttribute("currentPath", getRequestSubPath(reqres())); 37 | } 38 | 39 | forward("/"); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/dencode/web/servlet/pages/string/StringIndexServlet.java: -------------------------------------------------------------------------------- 1 | /*! 2 | * dencode-web 3 | * Copyright 2016 Mozq 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.dencode.web.servlet.pages.string; 18 | 19 | import jakarta.servlet.annotation.WebServlet; 20 | 21 | import com.dencode.web.servlet.AbstractDencodeHttpServlet; 22 | 23 | @WebServlet("/string/*") 24 | public class StringIndexServlet extends AbstractDencodeHttpServlet { 25 | private static final long serialVersionUID = 1L; 26 | 27 | @Override 28 | protected void doGet() throws Exception { 29 | String type = "string"; 30 | String method = "string." + reqres().pathParam("all"); 31 | 32 | reqres().setAttribute("type", type); 33 | reqres().setAttribute("method", method); 34 | 35 | if (reqres().attribute("currentPath") == null) { 36 | reqres().setAttribute("currentPath", getRequestSubPath(reqres())); 37 | } 38 | 39 | forward("/"); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | locales=en,ja,ru 2 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/error/404.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %> 3 | 4 | 5 | 6 | 7 | 404 Not Found 8 | 9 | 10 |

Page not found.

11 |

Go to top page

12 | 13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.atbash_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Atbash Cipher

3 |

Atbash cipher is one of the single transliteration ciphers that encrypts by replacing the characters in the text with other characters.

4 |

Character replacement is done by mapping the list of characters in reverse order.

5 |

For example, in the alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "A" is encrypted to "Z" and "B" to "Y".

6 | 7 |
Plain : ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | Cipher: ZYXWVUTSRQPONMLKJIHGFEDCBA
9 | 10 |
Plain text : THIS IS A SECRET MESSAGE
11 | Cipher text: GSRH RH Z HVXIVG NVHHZTV
12 | 13 |

It was originally used as a Hebrew cipher. The Hebrew encryption is as follows.

14 | 15 |
Plain : אבגדהוזחטיכלמנסעפצקרשת
16 | Cipher: תשרקצפעסנמלכיטחזוהדגבא
17 | 18 |

Since there is reciprocity that plaintext can be obtained by encrypting ciphertext again, decryption can be done in the same flow as encryption.

19 | 20 | 21 |

Other language support

22 |

In addition to Latin and Hebrew letters, Cyrillic and Japanese Hiragana / Katakana are supported.

23 | 24 |
Cyrillic
25 |
Plain : АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
26 | Cipher: ЯЮЭЬЫЪЩШЧЦХФУТСРПОНМЛКЙИЗЖЕДГВБА
27 | 28 |
Japanese Hiragana / Katakana
29 |
Plain : ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔ
30 | Cipher: ゔんをゑゐわゎろれるりらよょゆゅやゃもめむみまぽぼほぺべへぷぶふぴびひぱばはのねぬになどとでてづつっぢちだたぞそぜせずすじしざさごこげけぐくぎきがかおぉえぇうぅいぃあぁ
31 | 32 |
Plain : ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ
33 | Cipher: ヴンヲヱヰワヮロレルリラヨョユュヤャモメムミマポボホペベヘプブフピビヒパバハノネヌニナドトデテヅツッヂチダタゾソゼセズスジシザサゴコゲケグクギキガカオォエェウゥイィアァ
34 | 35 |

The character order is the Unicode definition order. Please note that "ゕ", "ゖ", "ヵ", "ヶ", "ヷ", "ヸ", "ヹ", and "ヺ" are not subject to encryption.

36 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.atbash_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

アトバシュ暗号について

3 |

アトバシュ暗号は、文章の文字を他の文字に置換することで暗号化する単一換字式暗号のひとつです。

4 |

文字の置換は、文字の一覧を逆順にマッピングすることで行います。

5 |

例えば、「ABCDEFGHIJKLMNOPQRSTUVWXYZ」の英字の場合、「A」は「Z」、「B」は「Y」に暗号化されます。

6 | 7 |
暗号化前: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | 暗号化後: ZYXWVUTSRQPONMLKJIHGFEDCBA
9 | 10 |
暗号化前の文章: THIS IS A SECRET MESSAGE
11 | 暗号化後の文章: GSRH RH Z HVXIVG NVHHZTV
12 | 13 |

もとはヘブライ語の暗号として使用されていました。ヘブライ語の暗号化は以下の通りです。

14 | 15 |
暗号化前: אבגדהוזחטיכלמנסעפצקרשת
16 | 暗号化後: תשרקצפעסנמלכיטחזוהדגבא
17 | 18 |

暗号文を再度暗号化すると平文が得られるという反転性があるため、暗号化と同じ流れで復号化もできます。

19 | 20 | 21 |

その他の言語サポート

22 |

ラテン文字やヘブライ語の他に、キリル文字、日本語の平仮名/片仮名をサポートしています。

23 | 24 |
キリル文字
25 |
暗号化前: АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
26 | 暗号化後: ЯЮЭЬЫЪЩШЧЦХФУТСРПОНМЛКЙИЗЖЕДГВБА
27 | 28 |
日本語の平仮名/片仮名
29 |
暗号化前: ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔ
30 | 暗号化後: ゔんをゑゐわゎろれるりらよょゆゅやゃもめむみまぽぼほぺべへぷぶふぴびひぱばはのねぬになどとでてづつっぢちだたぞそぜせずすじしざさごこげけぐくぎきがかおぉえぇうぅいぃあぁ
31 | 32 |
暗号化前: ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ
33 | 暗号化後: ヴンヲヱヰワヮロレルリラヨョユュヤャモメムミマポボホペベヘプブフピビヒパバハノネヌニナドトデテヅツッヂチダタゾソゼセズスジシザサゴコゲケグクギキガカオォエェウゥイィアァ
34 | 35 |

文字の順序は、Unicodeにおける定義順です。「ゕ」「ゖ」「ヵ」「ヶ」や「ヷ」「ヸ」「ヹ」「ヺ」は暗号化の対象ではないことに注意してください。

36 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.atbash_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О шифре Атбаша

3 |

Шифре Атбаша - это один из кодов единственного типа транслитерации, который шифрует, заменяя символы в тексте другими символами.

4 |

Замена символов выполняется путем сопоставления списка символов в обратном порядке.

5 |

Например, в алфавите «ABCDEFGHIJKLMNOPQRSTUVWXYZ» «A» зашифровывается как «Z», а «B» — как «Y».

6 | 7 |
Исходный алфавит: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | Шифрованный     : ZYXWVUTSRQPONMLKJIHGFEDCBA
9 | 10 |
Простой текст: THIS IS A SECRET MESSAGE
11 | Криптограмма : GSRH RH Z HVXIVG NVHHZTV
12 | 13 |

Первоначально он использовался как еврейский шифр. Шифрование на иврите выглядит следующим образом.

14 | 15 |
Исходный алфавит: אבגדהוזחטיכלמנסעפצקרשת
16 | Шифрованный     : תשרקצפעסנמלכיטחזוהדגבא
17 | 18 |

Поскольку открытый текст может быть получен путем повторного шифрования зашифрованного текста, дешифрование может выполняться в том же потоке, что и шифрование.

19 | 20 | 21 |

Поддержка других языков

22 |

Помимо латиницы и иврита, он поддерживает кириллицу и японскую хирагану/катакану.

23 | 24 |
Кириллица
25 |
Исходный алфавит: АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
26 | Шифрованный     : ЯЮЭЬЫЪЩШЧЦХФУТСРПОНМЛКЙИЗЖЕДГВБА
27 | 28 |
Японская хирагана/катакана
29 |
Исходный алфавит: ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔ
30 | Шифрованный     : ゔんをゑゐわゎろれるりらよょゆゅやゃもめむみまぽぼほぺべへぷぶふぴびひぱばはのねぬになどとでてづつっぢちだたぞそぜせずすじしざさごこげけぐくぎきがかおぉえぇうぅいぃあぁ
31 | 32 |
Исходный алфавит: ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ
33 | Шифрованный     : ヴンヲヱヰワヮロレルリラヨョユュヤャモメムミマポボホペベヘプブフピビヒパバハノネヌニナドトデテヅツッヂチダタゾソゼセズスジシザサゴコゲケグクギキガカオォエェウゥイィアァ
34 | 35 |

Порядок символов соответствует порядку определения Unicode. Обратите внимание, что "ゕ", "ゖ", "ヵ", "ヶ", "ヷ", "ヸ", "ヹ" и "ヺ" не подлежат шифрованию.

36 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.caesar_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Caesar Cipher

3 |

Caesar cipher is one of the single transliteration ciphers that encrypts by replacing the characters in the text with other characters.

4 |

Character replacement is performed by shifting the characters from "A" to "Z" among the 26 characters of "ABCDEFGHIJKLMNOPQRSTUVWXYZ".

5 |

For example, when shifting -3 characters, "A" is encrypted to "X" and "Z" is encrypted to "W".

6 | 7 |
Plain : ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW
9 | 10 |
Plain text : THIS IS A SECRET MESSAGE
11 | Cipher text: QEFP FP X PBZOBQ JBPPXDB
12 | 13 |

The number of shifts is the key to encryption.

14 |

Only letters are encrypted, not numbers or symbols.

15 |

If the number of shifts is 13, the result is the same as ROT13.

16 | 17 |

Shifts characters while retaining the diacritic mark. So, for example, "Á" is encrypted to "X́".

18 | 19 | 20 |

Other language support

21 |

In addition to Latin letters, Cyrillic and Japanese Hiragana / Katakana are supported.

22 | 23 |
Cyrillic
24 |

If you want to shift the Cyrillic character by -3 characters, it will be encrypted as follows.

25 | 26 |
Plain : АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
27 | Cipher: ЭЮЯАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬ
28 | 29 |

The diacritic mark shifts the character while holding it. So, for example, the Russian letter "Ё" is encrypted to "В̈". The characters "Й" and "й" are treated as unique characters, not the characters "И" and "и" with the diacritical mark " ̆" (Breve).

30 | 31 |
Japanese Hiragana / Katakana
32 |

If you want to shift the Japanese Hiragana / Katakana character by -3 characters, it will be encrypted as follows.

33 | 34 |
Plain : ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔ
35 | Cipher: をんゔぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑ
36 | 37 |
Plain : ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ
38 | Cipher: ヲンヴァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱ
39 | 40 |

The character order is the Unicode definition order. Please note that "ゕ", "ゖ", "ヵ", "ヶ", "ヷ", "ヸ", "ヹ", and "ヺ" are not subject to encryption.

41 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.caesar_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

シーザー暗号について

3 |

シーザー暗号は、文章の文字を他の文字に置換することで暗号化する単一換字式暗号のひとつです。

4 |

文字の置換は、「A」から「Z」までの文字を「ABCDEFGHIJKLMNOPQRSTUVWXYZ」の26文字の中でシフトさせることで行います。

5 |

例えば、-3文字シフトする場合は「A」は「X」、「Z」は「W」に暗号化されます。

6 | 7 |
暗号化前: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | 暗号化後: XYZABCDEFGHIJKLMNOPQRSTUVW
9 | 10 |
暗号化前の文章: THIS IS A SECRET MESSAGE
11 | 暗号化後の文章: QEFP FP X PBZOBQ JBPPXDB
12 | 13 |

シフトする数が暗号のキーになります。

14 |

英字のみが暗号化され、数字や記号などは暗号化されません。

15 |

シフトする数が13の場合、ROT13と同じ結果になります。

16 | 17 |

ダイアクリティカルマークを保持した状態で文字をシフトします。そのため、例えば「Á」は「X́」に暗号化されます。

18 | 19 | 20 |

その他の言語サポート

21 |

ラテン文字の他に、キリル文字、日本語の平仮名/片仮名をサポートしています。

22 | 23 |
キリル文字
24 |

キリル文字を-3文字シフトする場合は以下のように暗号化されます。

25 | 26 |
暗号化前: АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
27 | 暗号化後: ЭЮЯАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬ
28 | 29 |

ダイアクリティカルマークを保持した状態で文字をシフトします。そのため、例えばロシア語の「Ё」は「В̈」に暗号化されます。「Й」および「й」の文字は、「И」「и」にダイアクリティカルマークである「 ̆」(Breve)が付いた文字ではなく、固有の1文字として扱われます。

30 | 31 |
日本語の平仮名/片仮名
32 |

日本語の平仮名/片仮名を-3文字シフトする場合は以下のように暗号化されます。

33 | 34 |
暗号化前: ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔ
35 | 暗号化後: をんゔぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑ
36 | 37 |
暗号化前: ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ
38 | 暗号化後: ヲンヴァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱ
39 | 40 |

文字の順序は、Unicodeにおける定義順です。「ゕ」「ゖ」「ヵ」「ヶ」や「ヷ」「ヸ」「ヹ」「ヺ」は暗号化の対象ではないことに注意してください。

41 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.caesar_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О шифр цезаря

3 |

Шифр цезаря - это один из кодов единственного типа транслитерации, который шифрует, заменяя символы в тексте другими символами.

4 |

Замена символов выполняется путем сдвига символов с «A» на «Z» среди 26 символов «ABCDEFGHIJKLMNOPQRSTUVWXYZ».

5 |

Например, при сдвиге на -3 символа влево «A» зашифровывается до «X», а «Z» зашифровывается до «W».

6 | 7 |
Исходный алфавит: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | Шифрованный     : XYZABCDEFGHIJKLMNOPQRSTUVW
9 | 10 |
Простой текст: THIS IS A SECRET MESSAGE
11 | Криптограмма : QEFP FP X PBZOBQ JBPPXDB
12 | 13 |

Количество смен - ключ к шифрованию.

14 |

Шифруются только буквы, а не числа или символы.

15 |

Если количество смен равно 13, результат будет таким же, как и ROT13.

16 | 17 |

Сдвигает символы с сохранением диакритического знака. Так, например, «Á» зашифровано до «X́».

18 | 19 | 20 |

Поддержка других языков

21 |

Помимо латинских букв поддерживаются кириллица и японская хирагана/катакана.

22 | 23 |
Кириллица
24 |

При смещении символов кириллицы на -3 символа шифруется следующим образом.

25 | 26 |
Исходный алфавит: АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ
27 | Шифрованный     : ЭЮЯАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬ
28 | 29 |

Сдвигает символы с сохранением диакритического знака. Так, например, русское слово «Ё» зашифровано до «В̈». Символы «Й» и «й» рассматриваются как уникальные символы, а не «И» и «и» с диакритическим знаком « ̆» (Breve).

30 | 31 |
Японская хирагана/катакана
32 |

При сдвиге японской хираганы/катаканы на -3 символа шифруется следующим образом.

33 | 34 |
Исходный алфавит: ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔ
35 | Шифрованный     : をんゔぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑ
36 | 37 |
Исходный алфавит: ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴ
38 | Шифрованный     : ヲンヴァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱ
39 | 40 |

Порядок символов соответствует порядку определения Unicode. Обратите внимание, что "ゕ", "ゖ", "ヵ", "ヶ", "ヷ", "ヸ", "ヹ" и "ヺ" не подлежат шифрованию.

41 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rail-fence_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Rail Fence Cipher

3 |

Rail fence cipher is a transposition cipher.

4 |

Characters are arranged in a zigzag pattern on the rail of the fence, and finally, characters are concatenated in rails for encryption.

5 |

The encryption key is a number of rails.

6 | 7 |

For example, when "THIS_IS_A_SECRET_MESSAGE" is encrypted with 4 rails, it is as follows.

8 | 9 |

1. Prepare four rails (height 4) and arrange the characters in zigzag from the upper left.

10 |
-----------------------------------------------
11 | T           S           C           E          
12 | -----------------------------------------------
13 |   H       I   _       E   R       M   S       E
14 | -----------------------------------------------
15 |     I   _       A   S       E   _       S   G  
16 | -----------------------------------------------
17 |       S           _           T           A    
18 | -----------------------------------------------
19 | 20 |

2. Get the placed characters in each rail.

21 |
TSCE
22 | HI_ERMSE
23 | I_ASE_SG
24 | S_TA
25 | 26 |

3. Concatenated the rail characters.

27 |
TSCEHI_ERMSEI_ASE_SGS_TA
28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rail-fence_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

レールフェンス暗号について

3 |

レールフェンス暗号は、文章の文字を並べ替えることで暗号化する転置式暗号のひとつです。

4 |

レールフェンスはレール(横木)を使った柵の意味で、レールにジグザクに文字を配置して最後にレールの単位で文字を繋げることで暗号化します。

5 |

レールの本数が暗号のキーになります。

6 | 7 |

例えば、レール数を4本で「THIS_IS_A_SECRET_MESSAGE」を暗号化する場合は以下のようになります。

8 | 9 |

1. 4本のレールを用意し(高さ4)、左上から文字をジグザグに配置します。

10 |
-----------------------------------------------
11 | T           S           C           E          
12 | -----------------------------------------------
13 |   H       I   _       E   R       M   S       E
14 | -----------------------------------------------
15 |     I   _       A   S       E   _       S   G  
16 | -----------------------------------------------
17 |       S           _           T           A    
18 | -----------------------------------------------
19 | 20 |

2. 配置した文字を、レール単位で取得します。

21 |
TSCE
22 | HI_ERMSE
23 | I_ASE_SG
24 | S_TA
25 | 26 |

3. レールの文字を繋げます。

27 |
TSCEHI_ERMSEI_ASE_SGS_TA
28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rail-fence_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О шифр ограждения рельсов

3 |

Шифр ограждения рельсов является одним из шифров транспозиции.

4 |

буквы расположены зигзагообразно на рельсов и окончательно зашифрованы путем соединения символов на направляющих.

5 |

Ключ шифрования - это количество рельсов.

6 | 7 |

Например, когда «THIS_IS_A_SECRET_MESSAGE» зашифровано с помощью 4 рельсов, это выглядит следующим образом.

8 | 9 |

1. Подготовьте четыре рельсов (высота 4) и расположите буквы зигзагообразно.

10 |
-----------------------------------------------
11 | T           S           C           E          
12 | -----------------------------------------------
13 |   H       I   _       E   R       M   S       E
14 | -----------------------------------------------
15 |     I   _       A   S       E   _       S   G  
16 | -----------------------------------------------
17 |       S           _           T           A    
18 | -----------------------------------------------
19 | 20 |

2. Получите размещенных буквы в каждом рельсе.

21 |
TSCE
22 | HI_ERMSE
23 | I_ASE_SG
24 | S_TA
25 | 26 |

3. Соедините буквы на рейке.

27 |
TSCEHI_ERMSEI_ASE_SGS_TA
28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot13_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About ROT13

3 |

ROT13 is one of the single transliteration ciphers that encrypts by replacing the characters in the text with other characters.

4 |

Character replacement is performed by shifting the characters from "A" to "Z" by 13 characters out of the 26 characters of "ABCDEFGHIJKLMNOPQRSTUVWXYZ".

5 |

For example, "A" is encrypted to "N" and "Z" is encrypted to "M".

6 | 7 |
Plain : ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | Cipher: NOPQRSTUVWXYZABCDEFGHIJKLM
9 | 10 |
Plain text : THIS IS A SECRET MESSAGE
11 | Cipher text: GUVF VF N FRPERG ZRFFNTR
12 | 13 |

Since there is reciprocity that plaintext can be obtained by encrypting ciphertext again, decryption can be done in the same flow as encryption.

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot13_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

ROT13について

3 |

ROT13は、文章の文字を他の文字に置換することで暗号化する単一換字式暗号のひとつです。

4 |

文字の置換は、「A」から「Z」までの文字を「ABCDEFGHIJKLMNOPQRSTUVWXYZ」の26文字の中で13文字シフトさせることで行います。

5 |

例えば、「A」は「N」、「Z」は「M」に暗号化されます。

6 | 7 |
暗号化前: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | 暗号化後: NOPQRSTUVWXYZABCDEFGHIJKLM
9 | 10 |
暗号化前の文章: THIS IS A SECRET MESSAGE
11 | 暗号化後の文章: GUVF VF N FRPERG ZRFFNTR
12 | 13 |

暗号文を再度暗号化すると平文が得られるという反転性があるため、暗号化と同じ流れで復号化もできます。

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot13_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О ROT13

3 |

ROT13 - это один из кодов единственного типа транслитерации, который шифрует, заменяя символы в тексте другими символами.

4 |

Замена символов выполняется путем сдвига символов с «A» на «Z» на 13 символов из 26 символов «ABCDEFGHIJKLMNOPQRSTUVWXYZ».

5 |

Например, «A» зашифровано до «N», а «Z» зашифровано до «M».

6 | 7 |
Исходный алфавит: ABCDEFGHIJKLMNOPQRSTUVWXYZ
 8 | Шифрованный     : NOPQRSTUVWXYZABCDEFGHIJKLM
9 | 10 |
Простой текст: THIS IS A SECRET MESSAGE
11 | Криптограмма : GUVF VF N FRPERG ZRFFNTR
12 | 13 |

Поскольку открытый текст может быть получен путем повторного шифрования зашифрованного текста, дешифрование может выполняться в том же потоке, что и шифрование.

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot18_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About ROT18

3 |

ROT18 is one of the single transliteration ciphers that encrypts by replacing the characters in the text with other characters.

4 |

Character replacement is performed by shifting the characters from "A" to "Z" by 13 characters out of the 26 characters of "ABCDEFGHIJKLMNOPQRSTUVWXYZ". Also, the numbers "0" to "9" are shifted by 5 characters out of the 10 characters of "0123456789".

5 |

For example, "A" is encrypted to "N" and "0" is encrypted to "5".

6 | 7 |
Plain : ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
 8 | Cipher: NOPQRSTUVWXYZABCDEFGHIJKLM5678901234
9 | 10 |
Plain text : THIS IS A SECRET MESSAGE 123
11 | Cipher text: GUVF VF N FRPERG ZRFFNTR 567
12 | 13 |

Since there is reciprocity that plaintext can be obtained by encrypting ciphertext again, decryption can be done in the same flow as encryption.

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot18_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

ROT18について

3 |

ROT18は、文章の文字を他の文字に置換することで暗号化する単一換字式暗号のひとつです。

4 |

文字の置換は、「A」から「Z」までの文字を「ABCDEFGHIJKLMNOPQRSTUVWXYZ」の26文字の中で13文字シフトさせることで行います。また、数字の「0」から「9」は「0123456789」の10文字の中で5文字シフトさせます。

5 |

例えば、「A」は「N」、「0」は「5」に暗号化されます。

6 | 7 |
暗号化前: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
 8 | 暗号化後: NOPQRSTUVWXYZABCDEFGHIJKLM5678901234
9 | 10 |
暗号化前の文章: THIS IS A SECRET MESSAGE 123
11 | 暗号化後の文章: GUVF VF N FRPERG ZRFFNTR 567
12 | 13 |

暗号文を再度暗号化すると平文が得られるという反転性があるため、暗号化と同じ流れで復号化もできます。

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot18_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О ROT18

3 |

ROT18 - это один из кодов единственного типа транслитерации, который шифрует, заменяя символы в тексте другими символами.

4 |

Замена символов выполняется путем сдвига символов с «A» на «Z» на 13 символов из 26 символов «ABCDEFGHIJKLMNOPQRSTUVWXYZ». Кроме того, числа от «0» до «9» сдвинуты на 5 символов из 10 символов «0123456789».

5 |

Например, «A» зашифровано до «N», а «0» зашифровано до «5».

6 | 7 |
Исходный алфавит: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
 8 | Шифрованный     : NOPQRSTUVWXYZABCDEFGHIJKLM5678901234
9 | 10 |
Простой текст: THIS IS A SECRET MESSAGE 123
11 | Криптограмма : GUVF VF N FRPERG ZRFFNTR 567
12 | 13 |

Поскольку открытый текст может быть получен путем повторного шифрования зашифрованного текста, дешифрование может выполняться в том же потоке, что и шифрование.

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot47_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About ROT47

3 |

ROT47 is one of the single transliteration ciphers that encrypts by replacing the characters in the text with other characters.

4 |

Character replacement is performed by shifting the characters from "!" to "~" by 47 characters out of the 94 characters of "!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~".

5 |

For example, "!" is encrypted to "P", "A" is encrypted to "p" and "0" is encrypted to "_".

6 | 7 |
Plain : !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
 8 | Cipher: PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO
9 | 10 |
Plain text : THIS IS A SECRET MESSAGE 123!
11 | Cipher text: %wx$ x$ p $tr#t% |t$$pvt `abP
12 | 13 |

Since there is reciprocity that plaintext can be obtained by encrypting ciphertext again, decryption can be done in the same flow as encryption.

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot47_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

ROT47について

3 |

ROT47は、文章の文字を他の文字に置換することで暗号化する単一換字式暗号のひとつです。

4 |

文字の置換は、「!」から「~」までの文字を「!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~」の94文字の中で47文字シフトさせることで行います。

5 |

例えば、「!」は「P」、「A」は「p」、「0」は「_」に暗号化されます。

6 | 7 |
暗号化前: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
 8 | 暗号化後: PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO
9 | 10 |
暗号化前の文章: THIS IS A SECRET MESSAGE 123!
11 | 暗号化後の文章: %wx$ x$ p $tr#t% |t$$pvt `abP
12 | 13 |

暗号文を再度暗号化すると平文が得られるという反転性があるため、暗号化と同じ流れで復号化もできます。

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.rot47_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О ROT47

3 |

ROT47 - это один из кодов единственного типа транслитерации, который шифрует, заменяя символы в тексте другими символами.

4 |

Замена символов выполняется путем сдвига символов с «!» на «~» на 47 символов из 94 символов «!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~».

5 |

Например, "!" зашифровано до «P», «A» зашифровано до «p» и «0» зашифровано до «_».

6 | 7 |
Исходный алфавит: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
 8 | Шифрованный     : PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO
9 | 10 |
Простой текст: THIS IS A SECRET MESSAGE 123!
11 | Криптограмма : %wx$ x$ p $tr#t% |t$$pvt `abP
12 | 13 |

Поскольку открытый текст может быть получен путем повторного шифрования зашифрованного текста, дешифрование может выполняться в том же потоке, что и шифрование.

14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.scytale_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Scytale Cipher

3 |

Scytale cipher is one of the transposition ciphers. Scytale means baton in Greek.

4 |

A strip of parchment is wrapped around the scytale and encrypted by writing characters across the parchment.

5 |

The encryption key is the number of characters that can be written in one round of the scytale. Alternatively, you can also specify the number of characters that can be written in one line (the number of times parchment is wrapped).

6 | 7 |

For example, when "THIS_IS_A_SECRET_MESSAGE" is encrypted with 4 characters per one round of the scytale, it is as follows.

8 | 9 |

1. Place the characters across the strip of parchment.

10 |
-----------------------------------
11 |      | T | H | I | S | _ | I |___|
12 |      | S | _ | A | _ | S | E |
13 |   ___| C | R | E | T | _ | M |
14 |  |   | E | S | S | A | G | E |
15 | -----------------------------------
16 | 17 |

2. It is encrypted by unwinding the parchment from the scytale.

18 |
TSCEH_RSIAESS_TA_S_GIEME
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.scytale_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

スキュタレー暗号について

3 |

スキュタレー暗号は、文章の文字を並べ替えることで暗号化する転置式暗号のひとつです。スキュタレーはギリシャ語でバトンを意味しています。

4 |

棒に細長い羊皮紙を巻きつけ、羊皮紙を横断して文字を書いていくことで暗号化します。

5 |

棒の1周に書き込める文字数が暗号のキーになります。または、1行に書き込める文字数(羊皮紙を巻きつけた回数)も指定可能です。

6 | 7 |

例えば、棒の1周に書き込める文字数が4文字で「THIS_IS_A_SECRET_MESSAGE」を暗号化する場合は以下のようになります。

8 | 9 |

1. 羊皮紙を横断して文字を配置します。棒の1周に書き込める文字数が4文字で暗号化する文章が24文字のため、横に6文字まで配置していきます。

10 |
-----------------------------------
11 |      | T | H | I | S | _ | I |___|
12 |      | S | _ | A | _ | S | E |
13 |   ___| C | R | E | T | _ | M |
14 |  |   | E | S | S | A | G | E |
15 | -----------------------------------
16 | 17 |

2. 棒から羊皮紙をほどくことで暗号化されます。

18 |
TSCEH_RSIAESS_TA_S_GIEME
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_cipher.scytale_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О Шифр Сцитала

3 |

Шифр Сцитала - один из транспозиционных шифров. Сцитала в переводе с греческого означает жезл.

4 |

Оберните полоску пергамент вокруг палки, написав символы

5 |

Ключом шифрования является количество символов, которое можно записать за один раунд палки. Кроме того, вы также можете указать количество символов, которые можно написать в одной строке (количество раз, когда пергамент заворачивается).

6 | 7 |

Например, если количество символов, которые могут быть записаны в одном раунде полосы, равно 4 и «THIS_IS_A_SECRET_MESSAGE» зашифровано, это будет следующим.

8 | 9 |

1. Разместите буквы поперек пергамент. Поскольку количество символов, которые могут быть записаны за один раунд палки, равно 4, а текст, который нужно зашифровать, составляет 24 символа, мы расположим до 6 символов по горизонтали.

10 |
-----------------------------------
11 |      | T | H | I | S | _ | I |___|
12 |      | S | _ | A | _ | S | E |
13 |   ___| C | R | E | T | _ | M |
14 |  |   | E | S | S | A | G | E |
15 | -----------------------------------
16 | 17 |

2. Он зашифрован путем отматывания пергамент с палки.

18 |
TSCEH_RSIAESS_TA_S_GIEME
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.ctime_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About ctime date and time

3 |

ctime is a date and time notation format returned by the C language ctime() function.

4 | 5 |

For example, converting January 23, 2000 1:23:45.678 (JST) to ctime results in the following:

6 | 7 |
Mon Jan 03 01:23:45 2000
8 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.ctime_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

ctime日時について

3 |

ctimeは、C言語のctime()関数で返される日時表記の形式です。

4 | 5 |

例えば、2000年1月23日 1時23分45.678秒(JST) をctimeに変換し場合は以下の結果になります。

6 | 7 |
Mon Jan 03 01:23:45 2000
8 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.ctime_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О дате и времени ctime

3 |

ctime - это формат записи даты и времени, возвращаемый функцией ctime() языка C.

4 | 5 |

Например, преобразование 23 января 2000 г. 1: 23: 45.678 (JST) в ctime приведет к следующему:

6 | 7 |
Mon Jan 03 01:23:45 2000
8 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.iso8601_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About ISO 8601 date and time

3 |

ISO 8601 is a date and time notation format defined by ISO as an international standard.

4 |

The date and time are connected by "T" and written. The time zone is expressed as "+09:00" as the difference time from UTC, and in the case of UTC, it is expressed as "Z".

5 |

Separate seconds and milliseconds with a comma (,) or dot (.). DenCode omits milliseconds when milliseconds are 000.

6 | 7 |

ISO 8601 comes in several formats.

8 |

For example, converting January 23, 2000 1:23:45.678 (JST; +09:00) to ISO 8601 results in the following:

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
FormatConversion result
Basic format20000123T012345.678+0900
Extended format2000-01-23T01:23:45.678+09:00
Week dates (year - week - day of the week)2000-W03-7T01:23:45.678+09:00
Ordinal dates (year - day of the year)2000-023T01:23:45.678+09:00
18 |
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.iso8601_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

ISO 8601日時について

3 |

ISO 8601は、ISOで国際規格として定義された日時表記の形式です。

4 |

日付と時刻を「T」で繋げて表記します。タイムゾーンはUTCからの差分時刻として「+09:00」のように表記し、UTCの場合は「Z」で表します。

5 |

秒とミリ秒の間はカンマ(,)またはドット(.)で区切ります。DenCodeでは、ミリ秒が000の場合はミリ秒を省略します。

6 | 7 |

ISO 8601にはいくつかの形式があります。

8 |

例えば、2000年1月23日 1時23分45.678秒(JST; +09:00) をISO 8601に変換し場合は以下の結果になります。

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
形式変換結果
基本形式20000123T012345.678+0900
拡張形式2000-01-23T01:23:45.678+09:00
週 (年-週-曜日)2000-W03-7T01:23:45.678+09:00
日 (年-年内の日)2000-023T01:23:45.678+09:00
18 |
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.iso8601_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О дате и времени ISO 8601

3 |

ISO 8601 - это формат записи даты и времени, определенный ISO как международный стандарт.

4 |

Дата и время связаны буквой «Т» и пишутся. Часовой пояс выражается как «+09:00» как разница во времени с UTC, а в случае UTC - как «Z».

5 |

Разделите секунды и миллисекунды запятой (,) или точкой (.). В DenCode пропускает миллисекунду, когда миллисекунда равна 000.

6 | 7 |

ISO 8601 имеет несколько форматов.

8 |

Например, преобразование 23 января 2000 г. 1: 23: 45.678 (JST; +09:00) в ISO 8601 приведет к следующему:

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
форматРезультат конвертации
Основной формат20000123T012345.678+0900
Расширенный формат2000-01-23T01:23:45.678+09:00
Неделя (год-неделя-день)2000-W03-7T01:23:45.678+09:00
День (год-день года)2000-023T01:23:45.678+09:00
18 |
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.japanese-era_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Japanese Era

3 |

Japanese era is a Japanese date and time notation format.

4 |

The year is represented by the era and the number of years that follow. The first year is written as "元年" instead of "1年".

5 |

DenCode corresponds to Japanese era after 1868 (era name: Meiji).

6 | 7 |

For example, if you convert January 23, 2000 1:23:45.678 (JST) to Japanese era, you will get the following result.

8 | 9 |
平成12年01月03日01時23分45.678秒 JST
10 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.japanese-era_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

和暦について

3 |

和暦は、日本の日時表記の形式です。

4 |

元号とそれに続く年数によって年を表現します。1年目は「1年」ではなく「元年」と表記します。

5 |

DenCodeでは、1868年(元号: 明治)以降の和暦に対応します。

6 | 7 |

例えば、2000年1月23日 1時23分45.678秒(JST) を和暦に変換し場合は以下の結果になります。

8 | 9 |
平成12年01月03日01時23分45.678秒 JST
10 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.japanese-era_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О японской эре

3 |

Японская эра - это японский формат записи даты и времени.

4 |

Год представлен эрой и числом последующих лет. Первый год пишется как «元年» вместо «1 年».

5 |

DenCode соответствует японской эпохе после 1868 года (название эпохи: Мэйдзи).

6 | 7 |

Например, если вы конвертируете 23 января 2000 года 1: 23: 45.678 (JST) в японскую эру, вы получите следующий результат.

8 | 9 |
平成12年01月03日01時23分45.678秒 JST
10 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.rfc2822_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About RFC 2822 date and time

3 |

RFC 2822 is a date and time notation format defined in RFC 2822 (Internet Message Format).

4 |

RFC 2822 is used as the date and time notation in email headers.

5 | 6 |

For example, converting January 23, 2000 1:23:45.678 (JST) to RFC 2822 results in the following:

7 | 8 |
Sun, 23 Jan 2000 01:23:45 JST
9 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.rfc2822_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

RFC 2822日時について

3 |

RFC 2822は、RFC 2822 (Internet Message Format)で定義された日時表記の形式です。

4 |

RFC 2822は、Eメールヘッダーの日時表記として使用されています。

5 | 6 |

例えば、2000年1月23日 1時23分45.678秒(JST) をRFC 2822に変換し場合は以下の結果になります。

7 | 8 |
Sun, 23 Jan 2000 01:23:45 JST
9 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.rfc2822_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О дата и время RFC 2822

3 |

RFC 2822 - это формат записи даты и времени, определенный в RFC 2822 (Internet Message Format).

4 |

RFC 2822 используется в качестве даты и времени в заголовках электронной почты.

5 | 6 |

Например, преобразование 23 января 2000 г. 1: 23: 45.678 (JST) в RFC 2822 приведет к следующему:

7 | 8 |
Sun, 23 Jan 2000 01:23:45 JST
9 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.unix-time_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About UNIX time

3 |

UNIX time (POSIX time, Epoch time) is the number of seconds that have passed since the UNIX Epoch, January 1, 1970, 00:00:00 (UTC), not including leap seconds.

4 |

Times prior to UNIX Epoch are represented by negative values.

5 |

DenCode handles UNIX time in seconds. Milliseconds and microseconds are expressed as numbers after the decimal point.

6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 |
Date and timeUNIX time
1900-01-01 00:00:00 UTC-2208988800
1970-01-01 00:00:00 UTC (UNIX Epoch)0
2000-01-23 01:23:45.678 UTC948590625.678
14 |
15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.unix-time_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

UNIXタイムについて

3 |

UNIXタイム(POSIXタイム, エポック秒)は、UNIX Epochである 1970年1月1日 0時0分0秒(UTC) からの閏秒を含まない経過秒数です。

4 |

UNIX Epoch以前の時刻は、マイナス値で表します。

5 |

DenCodeでは、UNIX時刻を秒単位で扱います。ミリ秒やマイクロ秒は小数点以下の数値で表します。

6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 |
日時UNIXタイム
1900-01-01 00:00:00 UTC-2208988800
1970-01-01 00:00:00 UTC (UNIX Epoch)0
2000-01-23 01:23:45.678 UTC948590625.678
14 |
15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.unix-time_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О времени UNIX

3 |

Время UNIX (время POSIX, время Epoch) - это количество секунд, прошедших с UNIX Epoch, 1 января 1970 г., 00:00:00 (UTC), не включая секунды простоя.

4 |

Времена до UNIX Epoch представлены отрицательными значениями.

5 |

DenCode обрабатывает время UNIX в секундах. Миллисекунды и микросекунды выражаются десятичными числами.

6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 |
Дата и времяВремя UNIX
1900-01-01 00:00:00 UTC-2208988800
1970-01-01 00:00:00 UTC (UNIX Epoch)0
2000-01-23 01:23:45.678 UTC948590625.678
14 |
15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.w3cdtf_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About W3C-DTF date and time

3 |

W3C-DTF is a date and time notation format defined by W3C NOTE-datetime. A subset limited to only some formats of ISO 8601.

4 |

The date and time are connected by "T" and written. The time zone is expressed as "+09:00" as the difference time from UTC, and in the case of UTC, it is expressed as "Z".

5 |

Separate seconds and milliseconds with a dot (.).

6 | 7 |

W3C-DTF is used as a date and time notation for HTTP headers and RSS.

8 | 9 |

For example, converting January 23, 2000 1:23:45.678 (JST; +09:00) to W3C-DTF results in the following:

10 | 11 |
2000-01-23T01:23:45.678+09:00
12 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.w3cdtf_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

W3C-DTF日時について

3 |

W3C-DTFは、W3CのNOTE-datetimeで定義された日時表記の形式です。ISO 8601の一部の形式のみに限定したサブセットです。

4 |

日付と時刻を「T」で繋げて表記します。タイムゾーンはUTCからの差分時刻として「+09:00」のように表記し、UTCの場合は「Z」で表します。

5 |

秒とミリ秒の間はドット(.)で区切ります。

6 | 7 |

W3C-DTFは、HTTPヘッダーやRSSなどの日時表記として使用されています。

8 | 9 |

例えば、2000年1月23日 1時23分45.678秒(JST; +09:00) をW3C-DTFに変換し場合は以下の結果になります。

10 | 11 |
2000-01-23T01:23:45.678+09:00
12 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_date.w3cdtf_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О дате и времени W3C-DTF

3 |

W3C-DTF - это формат записи даты и времени, определяемый W3C NOTE-datetime. Подмножество ограничено только некоторыми форматами ISO 8601.

4 |

Дата и время связаны буквой «Т» и пишутся. Часовой пояс выражается как «+09:00» как разница во времени с UTC, а в случае UTC он выражается как «Z».

5 |

Разделите секунды и миллисекунды точкой (.).

6 | 7 |

W3C-DTF используется в качестве даты и времени для заголовков HTTP и RSS.

8 | 9 |

Например, преобразование 23 января 2000 г. 1: 23: 45.678 (JST; +09:00) в W3C-DTF приведет к следующему:

10 | 11 |
2000-01-23T01:23:45.678+09:00
12 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_number.bin_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

2進数について

3 |

2進数は、数値を2進記数法で表します。

4 | 5 |

2進数では、数値を2を底として「01」で表します。

6 | 7 |

2進数での変換例は以下の通りです。参考として、8進数と16進数の変換例も記載しています。

8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
10進数2進数8進数16進数
0000
1111
21022
711177
81000108
91001119
10101012A
15111117F
16100002010
17100012111
27 |
28 | 29 |

また、小数点以下の数値は2進数では 2-1 (1/2), 2-2 (1/4), 2-3 (1/8), ... の各位の値として変換します。小数点以下の数値が2-nの合計で表せない場合は、完全には2進数に変換できず誤差が発生します。その場合、DenCodeでは末尾に"..."を付加することで省略して表します。

30 | 31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
10進数2進数8進数16進数
0.50.10.40.8
0.750.110.60.C
0.90.11100110011001...0.71463...0.E666...
42 |
43 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_number.dec_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About decimal numbers

3 |

Decimal numbers represent numbers in decimal notation.

4 | 5 |

In decimal numbers, the number is represented by "0123456789" with 10 as the base.

6 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_number.dec_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

10進数について

3 |

10進数は、数値を10進記数法で表します。

4 | 5 |

10進数では、数値を10を底として「0123456789」で表します。

6 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_number.dec_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О десятичных числах

3 |

Десятичные числа представляют числа в десятичной системе счисления.

4 | 5 |

В десятичных числах это число представлено как «0123456789» с 10 в качестве основания.

6 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_number.hex_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

16進数について

3 |

16進数は、数値を16進記数法で表します。

4 | 5 |

16進数では、数値を16を底として「0123456789ABCDEF」で表します。10進数の 0 から 9 は16進数でも 0 から 9 で表し、 10 から 15 は A から F で表します。

6 | 7 |

16進数での変換例は以下の通りです。参考として、2進数と8進数の変換例も記載しています。

8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
10進数2進数8進数16進数
0000
1111
21022
711177
81000108
91001119
10101012A
15111117F
16100002010
17100012111
27 |
28 | 29 |

また、小数点以下の数値は16進数では 16-1 (1/16), 16-2 (1/256), 16-3 (1/4096), ... の各位の値として変換します。小数点以下の数値が16-nの合計で表せない場合は、完全には16進数に変換できず誤差が発生します。その場合、DenCodeでは末尾に"..."を付加することで省略して表します。

30 | 31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
10進数2進数8進数16進数
0.50.10.40.8
0.750.110.60.C
0.90.11100110011001...0.71463...0.E666...
42 |
43 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_number.oct_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

8進数について

3 |

8進数は、数値を8進記数法で表します。

4 | 5 |

8進数では、数値を8を底として「01234567」で表します。

6 | 7 |

8進数での変換例は以下の通りです。参考として、2進数と16進数の変換例も記載しています。

8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
10進数2進数8進数16進数
0000
1111
21022
711177
81000108
91001119
10101012A
15111117F
16100002010
17100012111
27 |
28 | 29 |

また、小数点以下の数値は8進数では 8-1 (1/8), 8-2 (1/64), 8-3 (1/512), ... の各位の値として変換します。小数点以下の数値が8-nの合計で表せない場合は、完全には8進数に変換できず誤差が発生します。その場合、DenCodeでは末尾に"..."を付加することで省略して表します。

30 | 31 |
32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
10進数2進数8進数16進数
0.50.10.40.8
0.750.110.60.C
0.90.11100110011001...0.71463...0.E666...
42 |
43 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.base32_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Base32

3 |

Base32 is an encoding method that uses printable ASCII characters.

4 |

In Base32, data is divided into 5 bits and converted into alphanumeric characters (A-Z, 2-7). Converts every 8 characters, and if the last is less than 8 characters, pad with the equal symbol (=).

5 | 6 |

The conversion table for Base32 characters is as follows.

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
5-bit dataBase32 character
00000A
00001B
00010C
00011D
00100E
00101F
00110G
00111H
01000I
01001J
01010K
01011L
01100M
01101N
01110O
01111P
10000Q
10001R
10010S
10011T
10100U
10101V
10110W
10111X
11000Y
11001Z
110102
110113
111004
111015
111106
111117
44 |
45 | 46 |

For example, if you convert "Hello!" with Base32, it will be as follows.

47 | 48 |

1. Make it a binary representation.

49 | 50 |
01001000 01100101 01101100 01101100 01101111 00100001  (For US-ASCII / UTF-8)
51 | 52 |

2. Separate every 5 bits. If it is less than 5 bits, pad it with "0" at the end.

53 | 54 |
01001 00001 10010 10110 11000 11011 00011 01111 00100 00100
55 | 56 |

3. Convert to characters using a conversion table. Convert every 8 characters, and if it is less than 8 characters, pad the end with "=".

57 | 58 |
JBSWY3DP EE======
59 | 60 |

4. Connect all the characters to get the Base32 conversion result.

61 | 62 |
JBSWY3DPEE======
63 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.base32_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

Base32について

3 |

Base32は、印字可能なASCII文字を使用した符号化方式です。

4 |

Base32では、データを5ビットずつに分割し、それらを英数字(A-Z, 2-7)の文字に変換して表します。8文字ごとに変換し、最後が8文字に満たない場合はイコール記号(=)でパディングします。

5 | 6 |

Base32の文字への変換表は以下のとおりです。

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
5ビットデータBase32文字
00000A
00001B
00010C
00011D
00100E
00101F
00110G
00111H
01000I
01001J
01010K
01011L
01100M
01101N
01110O
01111P
10000Q
10001R
10010S
10011T
10100U
10101V
10110W
10111X
11000Y
11001Z
110102
110113
111004
111015
111106
111117
44 |
45 | 46 |

例えば、「Hello!」をBase32で変換すると以下のようになります。

47 | 48 |

1. 2進数表現にする。

49 | 50 |
01001000 01100101 01101100 01101100 01101111 00100001  (US-ASCII / UTF-8の場合)
51 | 52 |

2. 5ビットごとに区切る。5ビットに満たない場合は末尾を「0」でパディングする。

53 | 54 |
01001 00001 10010 10110 11000 11011 00011 01111 00100 00100
55 | 56 |

3. 変換表を使用して文字に変換する。8文字ごとに変換し、8文字に満たない場合は末尾を「=」でパディングする。

57 | 58 |
JBSWY3DP EE======
59 | 60 |

4. 文字を全て繋げてBase32の変換結果とする。

61 | 62 |
JBSWY3DPEE======
63 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.base32_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О Base32

3 |

Base32 - это метод кодирования, использующий печатаемые символы ASCII.

4 |

В Base32 данные делятся на 5 бит и преобразуются в буквенно-цифровые символы (A-Z, 2-7). Преобразует каждые 8 символа, а если последний меньше 8 символов, заполните его символом равенства (=).

5 | 6 |

Таблица преобразования для символов Base32 выглядит следующим образом.

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
5-битные данныеBase32 символа
00000A
00001B
00010C
00011D
00100E
00101F
00110G
00111H
01000I
01001J
01010K
01011L
01100M
01101N
01110O
01111P
10000Q
10001R
10010S
10011T
10100U
10101V
10110W
10111X
11000Y
11001Z
110102
110113
111004
111015
111106
111117
44 |
45 | 46 |

Например, если вы конвертируете «Hello» с помощью Base32, это будет следующим образом.

47 | 48 |

1. Сделайте это двоичным представлением.

49 | 50 |
01001000 01100101 01101100 01101100 01101111 00100001  (Для US-ASCII / UTF-8)
51 | 52 |

2. Разделять каждые 5 бит. Если он меньше 5 бит, дополните его "0" в конце.

53 | 54 |
01001 00001 10010 10110 11000 11011 00011 01111 00100 00100
55 | 56 |

3. Преобразуйте в символы с помощью таблицы преобразования. Преобразуйте каждые 8 символа, и если оно меньше 8 символов, дополните конец знаком «=».

57 | 58 |
JBSWY3DP EE======
59 | 60 |

4. Соедините все символы, чтобы получить результат преобразования Base64.

61 | 62 |
JBSWY3DPEE======
63 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.bin_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Bin String

3 |

Bin string is the binary value of the string in binary notation.

4 |

Since the binary value differs depending on the character encoding, the conversion result to a bin string also differs.

5 | 6 |

For example, the result of converting "サンプル" to a bin string is as follows.

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 |
Character encodingBin string
UTF-811100011 10000010 10110101 11100011 10000011 10110011 11100011 10000011 10010111 11100011 10000011 10101011
UTF-1600110000 10110101 00110000 11110011 00110000 11010111 00110000 11101011
Shift_JIS10000011 01010100 10000011 10010011 10000011 01110110 10000011 10001011
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.bin_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

2進数文字列について

3 |

2進数文字列は、文字列のバイナリー値を2進数表記で表したものです。

4 |

文字エンコーディングによって、バイナリー値は異なるため、2進数文字列への変換結果も異なります。

5 | 6 |

例えば、「サンプル」を2進数文字列へ変換した結果は以下のとおりです。

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 |
文字エンコーディング2進数文字列
UTF-811100011 10000010 10110101 11100011 10000011 10110011 11100011 10000011 10010111 11100011 10000011 10101011
UTF-1600110000 10110101 00110000 11110011 00110000 11010111 00110000 11101011
Shift_JIS10000011 01010100 10000011 10010011 10000011 01110110 10000011 10001011
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.bin_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О двоичных символьных строках

3 |

Двоичная строка - это двоичное значение строки в двоичной записи.

4 |

Поскольку двоичное значение различается в зависимости от кодировки символов, результат преобразования в строку двоичных символов также отличается.

5 | 6 |

Например, результат преобразования «выборки» в двоичную символьную строку выглядит следующим образом.

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 |
Кодировка символовДвоичная строка
UTF-811010000 10110010 11010001 10001011 11010000 10110001 11010000 10111110 11010001 10000000 11010000 10111010 11010000 10111000
UTF-1600000100 00110010 00000100 01001011 00000100 00110001 00000100 00111110 00000100 01000000 00000100 00111010 00000100 00111000
KOI8-R11010111 11011001 11000010 11001111 11010010 11001011 11001001
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.camel-case_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About camel case conversion

3 |

Camel case is one of the naming conventions used in programming.

4 |

It supports conversion to the following formats.

5 | 6 |
7 | 8 | 9 | 10 | 11 |
NameAlternative nameFormat
Upper camel casePascal case, Studly caseUpperCamelCase
Lower camel caseCamel case, Dromedary caselowerCamelCase
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.camel-case_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

キャメルケースの変換について

3 |

キャメルケースは、プログラミングで使用される命名規約の一つです。

4 |

以下の形式への変換に対応します。

5 | 6 |
7 | 8 | 9 | 10 | 11 |
名称別名形式
Upper camel casePascal case, Studly caseUpperCamelCase
Lower camel caseCamel case, Dromedary caselowerCamelCase
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.camel-case_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О переделке верблюжьего футляра

3 |

Случай верблюда - одно из соглашений об именах, используемых в программировании.

4 |

Он поддерживает преобразование в следующие форматы.

5 | 6 |
7 | 8 | 9 | 10 | 11 |
имяальтернативное имяформат
Upper camel casePascal case, Studly caseUpperCamelCase
Lower camel caseCamel case, Dromedary caselowerCamelCase
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.character-width_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About conversion of half-width and full-width characters

3 |

Converts half-width characters and full-width characters to each other.

4 |

Supports letters (A-Z), numbers (0-9), symbols, Japanese katakana, and Korean Hangul.

5 | 6 |

For example, the result of converting the half-width character "Hello, world!" To the full-width character is as follows.

7 | 8 |
Hello, world!
9 | 10 |

In addition, the result of converting the Japanese full-width katakana "サンプル" to half-width katakana is as follows. The voiced sound mark (゛) and semi-voiced sound mark (゜) are converted into one half-width character.

11 | 12 |
サンプル
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.character-width_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

半角・全角文字の変換について

3 |

半角文字と全角文字を相互に変換します。

4 |

英字(A-Z)、数字(0-9)、記号、日本語のカタカナ、韓国語のハングルに対応します。

5 | 6 |

例えば、半角文字の「Hello, world!」を全角文字へ変換した結果は以下のとおりです。

7 | 8 |
Hello, world!
9 | 10 |

また、日本語の全角カタカナの「サンプル」を半角カタカナへ変換した結果は以下のとおりです。濁点(゛)や半濁点(゜)は半角文字の1文字に変換されます。

11 | 12 |
サンプル
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.character-width_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О преобразовании символов половинной и полной ширины

3 |

Преобразует символы половинной ширины и символы полной ширины друг в друга.

4 |

Он поддерживает буквы (A-Z), цифры (0-9), символы, японскую катакану и корейский корейский.

5 | 6 |

Например, результат преобразования символа половинной ширины «Hello, world!» В символ полной ширины выглядит следующим образом.

7 | 8 |
Hello, world!
9 | 10 |

Кроме того, результат преобразования японского «サンプル» катаканы полной ширины в катакану половинной ширины выглядит следующим образом. Точка помутнения (゛) и точка полумутности (゜) преобразуются в один символ полуширины.

11 | 12 |
サンプル
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.hex_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Hex String

3 |

Hex string is the binary value of the string in hexadecimal notation.

4 |

Since the binary value differs depending on the character encoding, the conversion result to a hex string also differs.

5 | 6 |

For example, the result of converting "サンプル" to a hex string is as follows.

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 |
Character encodingHex string
UTF-8E3 82 B5 E3 83 B3 E3 83 97 E3 83 AB
UTF-1630 B5 30 F3 30 D7 30 EB
Shift_JIS83 54 83 93 83 76 83 8B
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.hex_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

16進数文字列について

3 |

16進数文字列は、文字列のバイナリー値を16進数表記で表したものです。

4 |

文字エンコーディングによって、バイナリー値は異なるため、16進数文字列への変換結果も異なります。

5 | 6 |

例えば、「サンプル」を16進数文字列へ変換した結果は以下のとおりです。

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 |
文字エンコーディング16進数文字列
UTF-8E3 82 B5 E3 83 B3 E3 83 97 E3 83 AB
UTF-1630 B5 30 F3 30 D7 30 EB
Shift_JIS83 54 83 93 83 76 83 8B
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.hex_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О строках шестнадцатеричных символов

3 |

Шестнадцатеричная строка - это двоичное значение строки в шестнадцатеричной системе счисления.

4 |

Поскольку двоичное значение различается в зависимости от кодировки символов, результат преобразования в строку шестнадцатеричных символов также отличается.

5 | 6 |

Например, результат преобразования «выборки» в шестнадцатеричную строку выглядит следующим образом.

7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 |
Кодировка символовШестиугольная струна
UTF-8D0 B2 D1 8B D0 B1 D0 BE D1 80 D0 BA D0 B8
UTF-1604 32 04 4B 04 31 04 3E 04 40 04 3A 04 38
KOI8-RD7 D9 C2 CF D2 CB C9
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.kebab-case_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About kebab case conversion

3 |

Kebab case is one of the naming conventions used in programming.

4 |

It supports conversion to the following formats.

5 | 6 |
7 | 8 | 9 | 10 | 11 |
NameAlternative nameFormat
Upper kebab caseScreaming kebab case, Train case, COBOL caseUPPER-KEBAB-CASE
Lower kebab caseChain case, Dash case, Lisp caselower-kebab-case
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.kebab-case_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

ケバブケースの変換について

3 |

ケバブケースは、プログラミングで使用される命名規約の一つです。

4 |

以下の形式への変換に対応します。

5 | 6 |
7 | 8 | 9 | 10 | 11 |
名称別名形式
Upper kebab caseScreaming kebab case, Train case, COBOL caseUPPER-KEBAB-CASE
Lower kebab caseChain case, Dash case, Lisp caselower-kebab-case
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.kebab-case_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О переделке футляра для шашлыка

3 |

Падение кебаба - одно из соглашений об именах, используемых в программировании.

4 |

Он поддерживает преобразование в следующие форматы.

5 | 6 |
7 | 8 | 9 | 10 | 11 |
имяальтернативное имяформат
Upper kebab caseScreaming kebab case, Train case, COBOL caseUPPER-KEBAB-CASE
Lower kebab caseChain case, Dash case, Lisp caselower-kebab-case
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.naming-convention_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About conversion of naming conventions

3 |

Converts naming conventions such as variable names used in programming to each other.

4 |

It supports conversion to the following formats.

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
NameAlternative nameFormat
Upper camel casePascal case, Studly caseUpperCamelCase
Lower camel caseCamel case, Dromedary caselowerCamelCase
Upper snake caseScreaming snake case, Macro case, Constant caseUPPER_SNAKE_CASE
Lower snake casePothole caselower_snake_case
Upper kebab caseScreaming kebab case, Train case, COBOL caseUPPER-KEBAB-CASE
Lower kebab caseChain case, Dash case, Lisp caselower-kebab-case
16 |
17 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.naming-convention_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

命名規約の変換について

3 |

プログラミングで使用される変数名などの命名規約を相互に変換します。

4 |

以下の形式への変換に対応します。

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
名称別名形式
Upper camel casePascal case, Studly caseUpperCamelCase
Lower camel caseCamel case, Dromedary caselowerCamelCase
Upper snake caseScreaming snake case, Macro case, Constant caseUPPER_SNAKE_CASE
Lower snake casePothole caselower_snake_case
Upper kebab caseScreaming kebab case, Train case, COBOL caseUPPER-KEBAB-CASE
Lower kebab caseChain case, Dash case, Lisp caselower-kebab-case
16 |
17 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.naming-convention_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О преобразовании соглашения об именах

3 |

Преобразование соглашений об именах, таких как имена переменных, используемых в программировании, друг в друга.

4 |

Он поддерживает преобразование в следующие форматы.

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
имяальтернативное имяформат
Upper camel casePascal case, Studly caseUpperCamelCase
Lower camel caseCamel case, Dromedary caselowerCamelCase
Upper snake caseScreaming snake case, Macro case, Constant caseUPPER_SNAKE_CASE
Lower snake casePothole caselower_snake_case
Upper kebab caseScreaming kebab case, Train case, COBOL caseUPPER-KEBAB-CASE
Lower kebab caseChain case, Dash case, Lisp caselower-kebab-case
16 |
17 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.program-string_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Program String

3 |

A program string is a descriptive representation for defining a string in a programming language.

4 |

Enclose the string in quotes ("" or '') and escape the following characters with the \ symbol.

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
CharacterASCII code of characterEscape result
(NUL)0x00\0
(BEL)0x07\a
(BS)0x08\b
(HT)0x09\t
(LF)0x0A\n
(VT)0x0B\v
(FF)0x0C\f
(CR)0x0D\r
"0x22\"
'0x27\'
\0x5C\\
21 |
22 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.program-string_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

プログラム文字列について

3 |

プログラム文字列は、プログラミング言語で文字列を定義するための記述表現です。

4 |

文字列を引用符 ("" または '') で括り、以下の文字は\記号でエスケープします。

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
文字文字のASCIIコードエスケープ結果
(NUL)0x00\0
(BEL)0x07\a
(BS)0x08\b
(HT)0x09\t
(LF)0x0A\n
(VT)0x0B\v
(FF)0x0C\f
(CR)0x0D\r
"0x22\"
'0x27\'
\0x5C\\
21 |
22 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.program-string_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О программной строке

3 |

Строка программы - это описательное представление для определения строки на языке программирования.

4 |

Заключите строку в кавычки ("" или '') и экранируйте следующие символы символом \.

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
письмоКод ASCII символовРезультат побега
(NUL)0x00\0
(BEL)0x07\a
(BS)0x08\b
(HT)0x09\t
(LF)0x0A\n
(VT)0x0B\v
(FF)0x0C\f
(CR)0x0D\r
"0x22\"
'0x27\'
\0x5C\\
21 |
22 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.quoted-printable_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Quoted-printable

3 |

Quoted-printable is an encoding method that uses 7-bit printable ASCII characters. Used to transfer 8-bit data in a 7-bit data path in email.

4 |

Quoted-printable represents 8-bit data in 2-digit hexadecimal format, such as =XX. For example, "あ" in UTF-8 becomes "=E3=81=82". 7-bit printable characters such as "A" are not converted.

5 | 6 | 7 |

Email MIME message header type (RFC 2047)

8 |

DenCode also supports decoding of MIME message header format (RFC 2047), such as below. This format is used when the subject, recipient, etc. of the email contains non-ASCII characters.

9 | 10 |
Subject: =?UTF-8?Q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB?=
11 | 12 |

The result after decoding is as follows.

13 | 14 |
Subject: サンプル
15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.quoted-printable_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

Quoted-printableについて

3 |

Quoted-printableは、7ビットの印字可能なASCII文字を使用した符号化方式です。電子メールにおいて、8ビットデータを7ビットデータパスで転送するために使用します。

4 |

Quoted-printableでは、8ビットのデータを =XX のような16進数2桁の形式で表します。例えば「あ」はUTF-8で「=E3=81=82」となります。7ビットの印字可能な「A」などの文字は変換されません。

5 | 6 | 7 |

EメールのMIMEメッセージヘッダー型式 (RFC 2047)

8 |

DenCodeでは、以下のようなMIMEメッセージヘッダー型式(RFC 2047)のデコードもサポートします。この型式は、Eメールの件名や宛先などにASCII文字以外が含まれる場合に使用されます。

9 | 10 |
Subject: =?UTF-8?Q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB?=
11 | 12 |

デコードの後の結果は以下のとおりです。

13 | 14 |
Subject: サンプル
15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.quoted-printable_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О QP-кодировка

3 |

QP-кодировка - это метод кодирования, использующий 7-битные печатаемые символы ASCII. Используется для передачи 8-битных данных по 7-битному пути данных в электронной почте.

4 |

QP-кодировка представляет 8-битные данные в 2-значном шестнадцатеричном формате, например =XX. Например, «あ» в UTF-8 становится «=E3=81=82». 7-битные печатные символы, такие как «A», не преобразуются.

5 | 6 | 7 |

Формат заголовка сообщения электронной почты MIME (RFC 2047)

8 |

DenCode также поддерживает декодирование формата заголовка сообщения MIME (RFC 2047), как показано ниже. Этот формат используется, когда тема, получатель и т. Д. Электронного письма содержат символы, отличные от ASCII.

9 | 10 |
Subject: =?UTF-8?Q?=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=80?=
11 | 12 |

Результат после расшифровки следующий.

13 | 14 |
Subject: пример
15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.snake-case_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About snake case conversion

3 |

Snake case is one of the naming conventions used in programming.

4 |

It supports conversion to the following formats.

5 | 6 |
7 | 8 | 9 | 10 | 11 |
NameAlternative nameFormat
Upper snake caseScreaming snake case, Macro case, Constant caseUPPER_SNAKE_CASE
Lower snake casePothole caselower_snake_case
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.snake-case_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

スネークケースの変換について

3 |

スネークケースは、プログラミングで使用される命名規約の一つです。

4 |

以下の形式への変換に対応します。

5 | 6 |
7 | 8 | 9 | 10 | 11 |
名称別名形式
Upper snake caseScreaming snake case, Macro case, Constant caseUPPER_SNAKE_CASE
Lower snake casePothole caselower_snake_case
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.snake-case_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О преобразовании корпуса змеи

3 |

Змеиный регистр - одно из соглашений об именах, используемых в программировании.

4 |

Он поддерживает преобразование в следующие форматы.

5 | 6 |
7 | 8 | 9 | 10 | 11 |
имяальтернативное имяформат
Upper snake caseScreaming snake case, Macro case, Constant caseUPPER_SNAKE_CASE
Lower snake casePothole caselower_snake_case
12 |
13 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.unicode-normalization_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

About Unicode Normalization

3 |

Unicode normalization is the decomposition and composition of characters. Some Unicode characters have the same appearance but multiple representations. For example, "â" can be represented as one code point for "â" (U+00E2), and two decomposed code points for "a" (U+0061) and " ̂" (U+0302). It can also be expressed as (base character + combining character). The former is called a precomposed character and the latter is called a combining character sequence (CCS).

4 |

There are the following types of Unicode normalization:

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
Normalization FormDescriptionExample
Normalization Form D (NFD)Characters are decomposed by canonical equivalence"â" (U+00E2) -> "a" (U+0061) + " ̂" (U+0302)
Normalization Form KD (NFKD)Characters are decomposed by compatibility"fi" (U+FB01) -> "f" (U+0066) + "i" (U+0069)
Normalization Form C (NFC)Characters are decomposed and then re-composed by canonical equivalence"â" (U+00E2) -> "a" (U+0061) + " ̂" (U+0302) -> "â" (U+00E2)
Normalization Form KC (NFKC)Characters are decomposed by compatibility, then re-composed by canonical equivalence"fi" (U+FB01) -> "f" (U+0066) + "i" (U+0069) -> "f" (U+0066) + "i" (U+0069)
14 |
15 | 16 |

Canonical equivalence normalizes while preserving visually and functionally equivalent characters. e.g. "â" <-> "a" + " ̂"

17 |

In addition to canonical equivalence, compatibility equivalence also normalizes characters that have different semantic shapes. e.g. "fi" -> "f" + "i"

18 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.unicode-normalization_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

Unicode正規化について

3 |

Unicode正規化とは、文字を分解・合成することをいいます。Unicodeの文字は、見た目は同じでも複数の表現方法が存在するものがあります。例えば、「â」は「â」(U+00E2)の1つのコードポイントとしても表せますし、「a」(U+0061)と「 ̂」(U+0302)の2つの分解されたコードポイント(基底文字+結合文字)でも表せます。前者を合成済み文字、後者を結合文字列(combining character sequence, CCS)と呼びます。

4 |

Unicode正規化には、以下の種類があります。

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
正規化形式説明
Normalization Form D (NFD)正準等価で分解「â」(U+00E2) -> 「a」(U+0061) + 「 ̂」(U+0302)
Normalization Form KD (NFKD)互換等価で分解「fi」(U+FB01) -> 「f」(U+0066) + 「i」(U+0069)
Normalization Form C (NFC)正準等価で分解し再度合成「â」(U+00E2) -> 「a」(U+0061) + 「 ̂」(U+0302) -> 「â」(U+00E2)
Normalization Form KC (NFKC)互換等価で分解し、正準等価で再度合成「fi」(U+FB01) -> 「f」(U+0066) + 「i」(U+0069) -> 「f」(U+0066) + 「i」(U+0069)
14 |
15 | 16 |

正準等価は、視覚的および機能的に等価な文字を保った状態で正規化します。 例. 「â」 <-> 「a」 + 「 ̂」

17 |

互換等価は、正準等価の他に、意味的に異なる形をとる文字も正規化の対象となります。 例. 「fi」 -> 「f」 + 「i」

18 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/method-desc_string.unicode-normalization_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

О Нормализации Unicode

3 |

Нормализация Unicode - это декомпозиция и композиция символов. Некоторые символы Unicode имеют одинаковый внешний вид, но имеют несколько представлений. Например, «â» может быть представлен как одна кодовая точка для «â» (U+00E2) и две разложенные кодовые точки для «a» (U+0061) и « ̂» (U+0302). Его также можно выразить как (базовый символ + объединяющий символ). Первый называется предварительно составленным символом, а второй - последовательностью комбинируемых символов (combining character sequence, CCS).

4 |

Существуют следующие типы нормализации Unicode:

5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
Форма нормализацииОписаниепример
Normalization Form D (NFD)Персонажи разлагаются по канонической эквивалентности«â» (U+00E2) -> «a» (U+0061) + « ̂» (U+0302)
Normalization Form KD (NFKD)Персонажи разложены по совместимости«fi» (U+FB01) -> «f» (U+0066) + «i» (U+0069)
Normalization Form C (NFC)Персонажи раскладываются, а затем перекомпоновываются в соответствии с канонической эквивалентностью«â» (U+00E2) -> «a» (U+0061) + « ̂» (U+0302) -> «â» (U+00E2)
Normalization Form KC (NFKC)Символы разлагаются по совместимости, а затем перекомпоновываются в соответствии с канонической эквивалентностью«fi» (U+FB01) -> «f» (U+0066) + «i» (U+0069) -> «f» (U+0066) + «i» (U+0069)
14 |
15 | 16 |

Каноническая эквивалентность нормализуется при сохранении визуально и функционально эквивалентных символов. например «â» <-> «a» + « ̂»

17 |

Помимо канонической эквивалентности, эквивалентность совместимости также нормализует символы, имеющие разные семантические формы. например «fi» -> «f» + «i»

18 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/policy_en.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

Access Analysis

3 |

This site uses an access analysis service (Google Analytics).

4 |

These access analysis services use cookies to collect traffic data.

5 |

For more information, please check How Google uses information from sites or apps that use our services – Privacy & Terms – Google.

6 | 7 |

Advertisement

8 |

This site uses an advertising service (Google AdSense) to place ads distributed by third parties on the site.

9 |

These advertising services use cookies to display ads for products and services that are of interest to you.

10 |

For more information, please check Advertising – Privacy & Terms – Google.

11 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/policy_ja.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

アクセス解析

3 |

当サイトでは、アクセス解析サービス(Google Analytics)を利用して、アクセス解析を行っています。

4 |

このようなアクセス解析ツールは、トラフィックデータを収集するために、Cookieを使用しています。

5 |

詳しくは Google のサービスを使用するサイトやアプリから収集した情報の Google による使用 – ポリシーと規約 – Google をご確認ください。

6 | 7 |

広告

8 |

当サイトでは、第三者配信の広告サービス(Google AdSense)を利用して、第三者配信事業者や広告ネットワークの配信する広告をサイトに掲載しています。

9 |

このような広告サービスは、ユーザーの興味に応じた商品やサービスの広告を表示するために、Cookieを使用しています。

10 |

詳しくは 広告 – ポリシーと規約 – Google をご確認ください。

11 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/policy_ru.inc.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" 2 | %>

Анализ доступа

3 |

Этот сайт использует службу анализа доступа (Google Analytics).

4 |

Эти службы анализа доступа используют файлы cookie для сбора данных о трафике.

5 |

Для получения дополнительной информации, пожалуйста, нажмите Как Google обрабатывает информацию, которая поступает от сайтов и приложений, использующих наши сервисы – Политика конфиденциальности и Условия использования – Google.

6 | 7 |

Реклама

8 |

Этот сайт использует рекламную службу (Google AdSense) для размещения на сайте рекламы, распространяемой третьими сторонами.

9 |

Эти рекламные службы используют файлы cookie для показа рекламы продуктов и услуг, которые вас интересуют.

10 |

Для получения дополнительной информации, пожалуйста, нажмите Реклама – Политика конфиденциальности и Условия использования – Google.

11 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/pages/sitemap.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="application/xml; charset=UTF-8" pageEncoding="UTF-8" 2 | %><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" 3 | %><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" 4 | %><%@ taglib prefix="dc" uri="http://dencode.com/jsp/taglib" 5 | %> 6 | 8 | 9 | 10 | ${baseURL}${pageContext.request.contextPath}/${dc:h(path)} 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/taglib.tld: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 1.1 8 | dc 9 | http://dencode.com/jsp/taglib 10 | 11 | 12 | h 13 | com.dencode.web.jsp.TaglibFunctions 14 | java.lang.String escapeHTML(java.lang.String) 15 | 16 | 17 | 18 | jsstr 19 | com.dencode.web.jsp.TaglibFunctions 20 | java.lang.String escapeJavaScriptString(java.lang.String) 21 | 22 | 23 | 24 | fileLastModified 25 | com.dencode.web.jsp.TaglibFunctions 26 | long fileLastModified(jakarta.servlet.jsp.PageContext, java.lang.String) 27 | 28 | 29 | 30 | fileExists 31 | com.dencode.web.jsp.TaglibFunctions 32 | boolean fileExists(jakarta.servlet.jsp.PageContext, java.lang.String) 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | http://dencode.com/jsp/taglib 11 | /WEB-INF/taglib.tld 12 | 13 | 14 | 15 | 16 | 404 17 | /error/404 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/main/webapp/ads.txt: -------------------------------------------------------------------------------- 1 | google.com, pub-6871955725174244, DIRECT, f08c47fec0942fa0 -------------------------------------------------------------------------------- /src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozq/dencode-web/9e9ac26fddacf9f632309bbbbaeeec924cff252b/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /src/main/webapp/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DenCode", 3 | "short_name": "DenCode", 4 | "display": "browser", 5 | "icons": [ 6 | { 7 | "src": "static/img/icons/icon-192.png", 8 | "sizes": "192x192", 9 | "type": "image/png", 10 | "purpose": "any" 11 | }, 12 | { 13 | "src": "static/img/icons/icon-512.png", 14 | "sizes": "512x512", 15 | "type": "image/png", 16 | "purpose": "any" 17 | }, 18 | { 19 | "src": "static/img/icons/icon.svg", 20 | "sizes": "any", 21 | "type": "image/svg+xml", 22 | "purpose": "any" 23 | }, 24 | { 25 | "src": "static/img/icons/icon-maskable-512.png", 26 | "sizes": "512x512", 27 | "type": "image/png", 28 | "purpose": "maskable" 29 | }, 30 | { 31 | "src": "static/img/icons/icon-maskable.svg", 32 | "sizes": "any", 33 | "type": "image/svg+xml", 34 | "purpose": "maskable" 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /src/main/webapp/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozq/dencode-web/9e9ac26fddacf9f632309bbbbaeeec924cff252b/src/main/webapp/static/img/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/apple-touch-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozq/dencode-web/9e9ac26fddacf9f632309bbbbaeeec924cff252b/src/main/webapp/static/img/icons/icon-192.png -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozq/dencode-web/9e9ac26fddacf9f632309bbbbaeeec924cff252b/src/main/webapp/static/img/icons/icon-512.png -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/icon-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozq/dencode-web/9e9ac26fddacf9f632309bbbbaeeec924cff252b/src/main/webapp/static/img/icons/icon-maskable-512.png -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/icon-maskable.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/webapp/static/img/icons/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/main/webapp/static/js/adsense.js: -------------------------------------------------------------------------------- 1 | // Google AdSense 2 | ((window, document) => { 3 | "use strict"; 4 | 5 | const $ = new Commons(window, document); 6 | 7 | // Lazy load adsbygoogle.js 8 | const lazyLoadAdFn = $.on(window, "keydown click mousedown mousemove scroll", function () { 9 | $.off(window, "keydown click mousedown mousemove scroll", lazyLoadAdFn); 10 | 11 | const s = document.createElement("script"); 12 | s.src = "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"; 13 | s.async = true; 14 | document.body.appendChild(s); 15 | }); 16 | 17 | $.onReady(function () { 18 | const elListRows = $.all(".dencoded-list tr"); 19 | 20 | // Init Ads 21 | $.all(".adsbygoogle").forEach(() => { 22 | (window.adsbygoogle = window.adsbygoogle || []).push({}); 23 | }); 24 | 25 | // Show AdMiddle 26 | $.on(elListRows, "dencode:select-row", function () { 27 | const elAdBottom = $.id("adBottom"); 28 | 29 | if (elAdBottom.getElementsByClassName("adsbygoogle")[0]?.clientHeight < 50) { 30 | // Cannot load Ad 31 | return; 32 | } 33 | 34 | const adBottomRect = elAdBottom.getBoundingClientRect(); 35 | if (adBottomRect.top < window.innerHeight && 0 < adBottomRect.bottom) { 36 | // AdBottom is in viewport 37 | return; 38 | } 39 | 40 | // Show AdMiddle 41 | const elAdMiddle = $.id("adMiddle"); 42 | if (elAdMiddle) { 43 | this.parentNode.insertBefore(elAdMiddle, this.nextElementSibling); 44 | elAdMiddle.style.display = ""; 45 | } else { 46 | const adMiddleHtml = $.id("adMiddleTmpl").innerHTML; 47 | 48 | const elTmpl = document.createElement("template"); 49 | elTmpl.innerHTML = adMiddleHtml; 50 | const elAdMiddleNew = elTmpl.content; 51 | 52 | this.parentNode.insertBefore(elAdMiddleNew, this.nextElementSibling); 53 | (window.adsbygoogle = window.adsbygoogle || []).push({}); 54 | } 55 | }); 56 | 57 | // Hide AdMiddle 58 | $.on(elListRows, "dencode:deselect-row", function () { 59 | const elAdMiddle = $.id("adMiddle"); 60 | if (elAdMiddle) { 61 | elAdMiddle.style.display = "none"; 62 | } 63 | }); 64 | }); 65 | })(window, document); 66 | -------------------------------------------------------------------------------- /src/main/webapp/static/js/commons.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | class Commons { 4 | constructor(windowObject, documentObject) { 5 | this._window = windowObject; 6 | this._document = documentObject; 7 | } 8 | 9 | id(id) { 10 | return this._document.getElementById(id); 11 | } 12 | 13 | one(selector) { 14 | return this._document.querySelector(selector); 15 | } 16 | 17 | all(selector) { 18 | return [...this._document.querySelectorAll(selector)]; 19 | } 20 | 21 | onReady(listener) { 22 | if (this._document.readyState === "loading") { 23 | this._document.addEventListener("DOMContentLoaded", listener); 24 | } else { 25 | listener(); 26 | } 27 | } 28 | 29 | on(target, type, listener, options) { 30 | if (target === null) { 31 | return null; 32 | } 33 | 34 | let elements = target; 35 | let listenerFn = listener; 36 | if (typeof elements === "string") { 37 | const selector = elements; 38 | 39 | elements = [this._document]; 40 | listenerFn = function (event) { 41 | const elTarget = event.target.closest(selector); 42 | if (elTarget) { 43 | return listener.apply(elTarget, arguments); 44 | } 45 | return true; 46 | }; 47 | } else if (!elements.forEach) { 48 | elements = [elements]; 49 | } 50 | 51 | const types = type.split(/\s+/); 52 | 53 | elements.forEach((el) => { 54 | types.forEach((t) => { 55 | el.addEventListener(t, listenerFn, options); 56 | }) 57 | }); 58 | 59 | return listenerFn; 60 | } 61 | 62 | off(target, type, listener, options) { 63 | if (target === null) { 64 | return; 65 | } 66 | 67 | let elements = target; 68 | if (typeof elements === "string") { 69 | elements = [this._document]; 70 | } else if (!elements.forEach) { 71 | elements = [elements]; 72 | } 73 | 74 | const types = type.split(/\s+/); 75 | 76 | elements.forEach((el) => { 77 | types.forEach((t) => { 78 | el.removeEventListener(t, listener, options); 79 | }) 80 | }); 81 | } 82 | } 83 | --------------------------------------------------------------------------------