Skip to content

Commit 0c76994

Browse files
authored
Merge branch 'main' into main
2 parents 1dd60a1 + d905b0c commit 0c76994

File tree

28 files changed

+1673
-57
lines changed

28 files changed

+1673
-57
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
contact_links:
2+
- name: CodeHarborHub Q&A
3+
url: https://codeharborhub.github.io/community/supports#-how-to-get-support
4+
about: Get help from the community with any questions or issues.
5+
6+
- name: CodeHarborHub Features
7+
url: https://codeharborhub.github.io/community/features
8+
about: Explore the features and capabilities of CodeHarborHub.
9+
10+
- name: Meet the Founder or Owner
11+
url: https://codeharborhub.github.io/me/
12+
about: Learn more about the founder and owner of CodeHarborHub.
Loading
Loading
Loading
Loading
Loading
Loading
Loading

blog/Building RESTful CRUD API in springboot/index.md

Lines changed: 571 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: 'Cryptography and Its Use in Cyber Security'
3+
sidebar_label: Cryptography and Cyber Security
4+
authors: [pujan-sarkar]
5+
tags: [cryptography, cyber security, encryption, technology]
6+
date: 2024-06-24
7+
hide_table_of_contents: true
8+
---
9+
10+
## Introduction
11+
12+
In the realm of cyber security, cryptography stands as a critical tool for protecting information. As digital data exchange grows exponentially, the importance of cryptography in ensuring data security and privacy cannot be overstated. This blog explores the fundamental concepts of cryptography, its historical significance, and its contemporary applications in cyber security.
13+
14+
## Understanding Cryptography
15+
16+
Cryptography is the science of encoding and decoding information to protect it from unauthorized access. It involves various techniques and algorithms that transform readable data, known as plaintext, into an unreadable format, known as ciphertext. Only those who possess the appropriate decryption key can convert the ciphertext back into plaintext.
17+
18+
### Key Concepts in Cryptography
19+
20+
1. **Encryption and Decryption**: The process of converting plaintext into ciphertext is called encryption, while the process of converting ciphertext back into plaintext is called decryption.
21+
2. **Symmetric Key Cryptography**: The same key is used for both encryption and decryption. Examples include AES and DES.
22+
3. **Asymmetric Key Cryptography**: Uses a pair of keys - a public key for encryption and a private key for decryption. Examples include RSA and ECC.
23+
4. **Hash Functions**: Take an input and produce a fixed-size string of characters, which is typically a hash value. Hash functions are used for data integrity and password storage.
24+
25+
## Historical Significance of Cryptography
26+
27+
Cryptography has been used for centuries to secure communication. Some historical milestones include:
28+
29+
- **Caesar Cipher**: Used by Julius Caesar to protect military messages, this substitution cipher shifts letters by a fixed number of positions in the alphabet.
30+
- **Enigma Machine**: Used by the Germans during World War II, this electromechanical device encrypted messages. The successful decryption of Enigma-encrypted messages by the Allies significantly impacted the war's outcome.
31+
- **Diffie-Hellman Key Exchange**: Introduced in 1976, this method allowed secure key exchange over a public channel, laying the groundwork for modern public-key cryptography.
32+
33+
## Cryptography in Modern Cyber Security
34+
35+
In today's digital world, cryptography is essential for securing data and maintaining privacy. Its applications are vast and varied:
36+
37+
### Secure Communication
38+
39+
Cryptography ensures that communication between parties remains confidential and secure. Protocols like SSL/TLS use cryptographic techniques to protect data transmitted over the internet, such as during online banking and shopping.
40+
41+
### Data Integrity
42+
43+
Hash functions play a crucial role in ensuring data integrity. When data is transmitted or stored, hash functions can verify that the data has not been altered. This is particularly important for software distribution and digital signatures.
44+
45+
### Authentication
46+
47+
Cryptographic methods are used to verify the identities of users and devices. Passwords are typically stored as hash values, and public-key infrastructure (PKI) systems use digital certificates to authenticate entities.
48+
49+
### Blockchain Technology
50+
51+
Cryptography is the backbone of blockchain technology. Cryptographic hashing ensures the integrity of data blocks, while asymmetric cryptography secures transactions and verifies identities. This technology underpins cryptocurrencies like Bitcoin and has applications in various fields, including supply chain management and healthcare.
52+
53+
### Secure Storage
54+
55+
Encrypting data at rest ensures that even if unauthorized individuals gain access to storage media, they cannot read the data without the decryption key. This is crucial for protecting sensitive information on devices and in cloud storage.
56+
57+
## Challenges in Cryptography
58+
59+
While cryptography is a powerful tool, it is not without challenges:
60+
61+
- **Key Management**: Securely generating, storing, and distributing cryptographic keys is complex and critical for maintaining security.
62+
- **Performance Overheads**: Cryptographic operations can be computationally intensive, affecting system performance, especially in resource-constrained environments.
63+
- **Quantum Computing**: Emerging quantum computers have the potential to break many of the cryptographic algorithms currently in use, necessitating the development of quantum-resistant algorithms.
64+
65+
## Future Directions in Cryptography
66+
67+
The field of cryptography is continuously evolving to address emerging threats and challenges. Some future directions include:
68+
69+
### Post-Quantum Cryptography
70+
71+
With the advent of quantum computing, researchers are developing cryptographic algorithms that are resistant to quantum attacks. These algorithms aim to provide security even in the presence of powerful quantum computers.
72+
73+
### Homomorphic Encryption
74+
75+
This advanced form of encryption allows computations to be performed on encrypted data without decrypting it. Homomorphic encryption has significant implications for data privacy, particularly in cloud computing and data analysis.
76+
77+
### Zero-Knowledge Proofs
78+
79+
Zero-knowledge proofs enable one party to prove to another that a statement is true without revealing any information beyond the validity of the statement. This concept has applications in authentication, privacy-preserving protocols, and blockchain technology.
80+
81+
## Conclusion
82+
83+
Cryptography is a cornerstone of cyber security, providing the means to protect data and maintain privacy in an increasingly interconnected world. As technology advances and new threats emerge, the field of cryptography will continue to evolve, offering innovative solutions to ensure the security and integrity of our digital lives. By understanding and implementing cryptographic techniques, individuals and organizations can safeguard their information and build a secure future.
84+

docs/dsa/algorithms/image-8.png

25.3 KB
Loading
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
id: patternsearching-in-dsa
3+
title: Pattern Searching Algorithm in Data Structures and Algorithms
4+
sidebar_label: Pattern Searching Algorithm
5+
sidebar_position: 7
6+
description: "The Pattern Searching Algorithm is a powerful tool used to find occurrences of a pattern within a larger text or string."
7+
tags: [dsa,data-algorithms , pattern-searching]
8+
---
9+
10+
11+
The Pattern Searching Algorithm is a powerful tool used to find occurrences of a pattern within a larger text or string. It is commonly employed in string matching problems, where the goal is to search for a specific pattern or substring within a given text.
12+
13+
![pattern search](image-8.png)
14+
15+
This algorithm compares the pattern with each possible substring of the text, starting from the leftmost position. When a match is found, the algorithm reports the index or position of the match. There are several variations of the Pattern Searching Algorithm, including the Naive Pattern Searching Algorithm, Knuth-Morris-Pratt (KMP) Algorithm, Rabin-Karp Algorithm, and Boyer-Moore Algorithm, each with its own advantages and disadvantages.
16+
17+
### Advantages of the Pattern Searching Algorithm:
18+
19+
1. Versatility: The algorithm can be applied to various string matching problems, making it a valuable tool in many applications.
20+
2. Flexibility: Different variations of the algorithm allow for different trade-offs in terms of time complexity, space complexity, and implementation complexity.
21+
3. Efficiency: Depending on the specific variation used, the Pattern Searching Algorithm can achieve efficient search times, particularly in large texts.
22+
23+
### Disadvantages of the Pattern Searching Algorithm:
24+
25+
1. Complexity: Some variations of the algorithm can be complex to understand and implement, especially for beginners.
26+
2. Performance: The performance of the algorithm can vary depending on the specific variation used and the characteristics of the input text and pattern. In some cases, the algorithm may not be the most efficient solution.
27+
28+
Here's an example code problem to illustrate the usage of the Pattern Searching Algorithm:
29+
30+
```python
31+
```python
32+
def pattern_search(text, pattern):
33+
result = []
34+
text_length = len(text)
35+
pattern_length = len(pattern)
36+
37+
for i in range(text_length - pattern_length + 1):
38+
j = 0
39+
while j < pattern_length:
40+
if text[i + j] != pattern[j]:
41+
break
42+
j += 1
43+
if j == pattern_length:
44+
result.append(i)
45+
46+
return result
47+
48+
text = "ABABDABACDABABCABAB"
49+
pattern = "ABABC"
50+
matches = pattern_search(text, pattern)
51+
print("Pattern found at positions:", matches)
52+
```
53+
54+
In this example, we have a text string "ABABDABACDABABCABAB" and we want to search for the pattern "ABABC" within it. The `patternSearch` function implements the Naive Pattern Searching Algorithm. It iterates through the text, comparing each substring of the same length as the pattern with the pattern itself. If a match is found, the starting position of the match is added to the result array. Finally, the function returns the array of positions where the pattern was found.
55+
56+
When we run this code, it will output: "Pattern found at positions: [0, 10]". This means that the pattern "ABABC" was found at positions 0 and 10 within the text string.
57+
58+
59+
The pattern search algorithm, also known as the Naive Pattern Searching Algorithm, is a simple and straightforward approach to finding occurrences of a pattern within a text string. It works by iterating through the text and comparing each substring of the same length as the pattern with the pattern itself.
60+
61+
The algorithm starts by initializing an empty array to store the positions where the pattern is found. Then, it iterates through the text string, comparing each substring of the same length as the pattern with the pattern itself. If a match is found, the starting position of the match is added to the result array.
62+
63+
Once the algorithm has finished iterating through the entire text, it returns the array of positions where the pattern was found. This allows us to determine the locations of all occurrences of the pattern within the text.
64+
65+
The Naive Pattern Searching Algorithm is relatively simple to implement and understand, making it a good starting point for pattern searching tasks. However, it has a time complexity of O((n-m+1)*m), where n is the length of the text and m is the length of the pattern. This means that the algorithm's performance can degrade for large texts or patterns.
66+
67+
There are more advanced pattern searching algorithms, such as the Knuth-Morris-Pratt (KMP) algorithm and the Boyer-Moore algorithm, which offer better time complexity and improved performance in certain scenarios. However, the Naive Pattern Searching Algorithm serves as a foundation for understanding pattern searching concepts and can be a useful starting point for simple cases.

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ title: Welcome to CodeHarborHub Tutorials
44
sidebar_label: Welcome to CodeHarborHub
55
sidebar_position: 1
66
slug: /
7+
sidebar_class_name: "tutorial-learning-tasks"
78
---
89

910
Hello, and welcome to CodeHarborHub! Our mission is to provide accessible and comprehensive educational resources to learners of all levels, from beginners to advanced professionals. Whether you're looking to kickstart your career in web development, master a new programming language, or stay updated on the latest tech trends, we've got you covered.

docusaurus.config.js

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2-
import { faLinkedin, faYoutube, faDiscord, } from '@fortawesome/free-brands-svg-icons';
3-
4-
import { themes as prismThemes } from "prism-react-renderer";
51
import { default as npm2yarn } from "@docusaurus/remark-plugin-npm2yarn";
2+
import { themes as prismThemes } from "prism-react-renderer";
3+
64
const remarkMath = require("remark-math");
75
const rehypeKatex = require("rehype-katex");
86

@@ -96,11 +94,21 @@ const config = {
9694
{ name: "twitter:creator", content: "@CodesWithAjay" },
9795
{ property: "og:type", content: "website" },
9896
{ property: "og:site_name", content: "CodeHarborHub" },
99-
{ property: "og:title", content: "CodeHarborHub - A place to learn and grow" },
100-
{ property: "og:description", content: "CodeHarborHub is a place to learn and grow. We provide accessible and comprehensive educational resources to learners of all levels, from beginners to advanced professionals."},
101-
{ property: "og:image", content: "https://codeharborhub.github.io/img/nav-logo.jpg" },
97+
{
98+
property: "og:title",
99+
content: "CodeHarborHub - A place to learn and grow",
100+
},
101+
{
102+
property: "og:description",
103+
content:
104+
"CodeHarborHub is a place to learn and grow. We provide accessible and comprehensive educational resources to learners of all levels, from beginners to advanced professionals.",
105+
},
106+
{
107+
property: "og:image",
108+
content: "https://codeharborhub.github.io/img/nav-logo.jpg",
109+
},
102110
{ property: "og:url", content: "https://codeharborhub.github.io" },
103-
{ name: "robots", content: "index, follow" },
111+
{ name: "robots", content: "index, follow" },
104112
],
105113

106114
algolia: {
@@ -130,13 +138,15 @@ const config = {
130138
<a href="/docs/category/html/" class="nav__icons"> <img src="/icons/html-5.svg" title="HTML5" alt="HTML" /> </a>
131139
<a href="/docs/" class="nav__icons"> <img src="/icons/css.svg" title="CSS" alt="CSS" /> </a>
132140
<a href="/docs/category/javascript/" class="nav__icons" > <img src="/icons/js.svg" title="JavaScript" alt="JavaScript" /> </a>
133-
<a href="/docs/category/react/" class="nav__icons"> <img src="/icons/jsx.svg" title="React.Js" alt="React" /> </a>
134-
<a href="/docs/category/typescript/" class="nav__icons"> <img src="/icons/ts.svg" title="TypeScript" alt="TypeScript" /> </a>
135-
<a href="/docs/category/python/" class="nav__icons"> <img src="/icons/py.svg" title="Python" alt="Python" /> </a>
136-
<a href="/docs/category/java/" class="nav__icons"> <img src="/icons/java.svg" title="Java" alt="Java" /> </a>
141+
<a href="/docs/category/react/" class="nav__icons"> <img src="/icons/jsx.svg" title="React.Js" alt="React" /> </a>
142+
<a href="/docs/category/typescript/" class="nav__icons"> <img src="/icons/ts.svg" title="TypeScript" alt="TypeScript" /> </a>
143+
<a href="/docs/category/python/" class="nav__icons"> <img src="/icons/py.svg" title="Python" alt="Python" /> </a>
144+
<a href="/docs/category/java/" class="nav__icons"> <img src="/icons/java.svg" title="Java" alt="Java" /> </a>
137145
<a href="/docs/category/tailwind/" class="nav__icons"> <img src="/icons/tailwind-css.svg" title="Tailwind CSS" alt="Tailwind" /> </a>
138146
<a href="/docs/category/cpp/" class="nav__icons"> <img src="/icons/cpp.svg" title="CPP" alt="CPP" /> </a>
139-
<a href="/docs/category/NextJs/" class="nav__icons"> <img src="/icons/next-js.svg" title="NextJs" alt="Next" /> </a>
147+
<a href="/docs/category/NextJs/" class="nav__icons"> <img src="/icons/next-js.svg" title="NextJs" alt="Next" /> </a>
148+
<a href="/docs/category/MATLAB/" class="nav__icons"> <img src="/icons/matlab.svg" title="MATLAB" alt="MATLAB" /> </a>
149+
<a href="/docs/category/Julia/" class="nav__icons"> <img src="/icons/julia.svg" title="Julia" alt="Julia" /> </a>
140150
</div>
141151
</div>`,
142152
},
@@ -151,7 +161,7 @@ const config = {
151161
value: `<div class="dropdown">
152162
<a class="dropbtn" href="/courses/"> Courses&nbsp; </a>
153163
<div class="dropdown-content">
154-
<a href="/courses/category/reactjs/" class="nav__icons"> <img src="/icons/jsx.svg" alt="React" /> </a>
164+
<a href="/courses/category/reactjs/" class="nav__icons"> <img src="/icons/jsx.svg" alt="React" /> </a>
155165
</div>
156166
</div>`,
157167
},
@@ -362,22 +372,19 @@ const config = {
362372
{
363373
label: "LinkedIn",
364374
href: "https://www.linkedin.com/company/codeharborhub/",
365-
icon: 'faLinkedin',
366375
},
367376
{
368377
label: "YouTube",
369378
href: "https://www.youtube.com/",
370-
icon: 'faYoutube',
379+
icon: "faYoutube",
371380
},
372381
{
373382
label: "Discord",
374383
href: "https://discord.gg/c53FQn3pRv",
375-
icon: 'faDiscord',
376384
},
377385
{
378386
label: "Twitter(X)",
379387
href: "https://twitter.com/CodesWithAjay",
380-
icon: 'faTwitter',
381388
},
382389
],
383390
},

dsa-solutions/gfg-solutions/Basic/0093.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
id: replace-zeros-with-fives
2+
id: replace-zeros-with-five
33
title: Replace All 0's with 5
44
sidebar_label: 0093 Replace All 0's with 5
55
tags:
6-
- Python
7-
- Java
8-
- C++
9-
- C
6+
- Python
7+
- Java
8+
- C++
9+
- C
1010
description: "This document covers methods to replace all occurrences of the digit 0 with the digit 5 in a given number in various programming languages."
1111
---
1212

@@ -15,7 +15,9 @@ description: "This document covers methods to replace all occurrences of the dig
1515
Given a number N. The task is to complete the function **convertFive()** which replaces all zeros in the number with 5 and returns the number.
1616

1717
### Examples:
18+
1819
**Example 1:**
20+
1921
```
2022
Input
2123
2
@@ -50,7 +52,9 @@ Since this is a functional problem you don't have to worry about input, you just
5052
- $1 <= N <= 10^4$
5153

5254
## Solution
55+
5356
### Python
57+
5458
```python
5559
def convertFive(self,n):
5660
num_str = str(n)
@@ -64,6 +68,7 @@ def convertFive(self,n):
6468
```
6569

6670
### Java
71+
6772
```java
6873
public static int convertFive(int n){
6974
String numStr = String.valueOf(n);
@@ -72,7 +77,7 @@ public static int convertFive(int n){
7277
char currentChar = numStr.charAt(i);
7378
if (currentChar == '0') {
7479
result.append('5');
75-
}
80+
}
7681
else {
7782
result.append(currentChar);
7883
}
@@ -83,6 +88,7 @@ public static int convertFive(int n){
8388
```
8489

8590
### C++
91+
8692
```cpp
8793
int convertFive(int n) {
8894
string numStr = to_string(n);
@@ -97,6 +103,7 @@ int convertFive(int n) {
97103
```
98104
99105
### C
106+
100107
```c
101108
int convertFive(int n) {
102109
int result = 0;
@@ -105,7 +112,7 @@ int convertFive(int n) {
105112
int digit = n % 10;
106113
if (digit == 0) {
107114
result += 5 * position;
108-
}
115+
}
109116
else {
110117
result += digit * position;
111118
}

0 commit comments

Comments
 (0)