{"id":21289684,"url":"https://github.com/piriyaraj/qr-code-generator","last_synced_at":"2025-03-15T16:11:11.862Z","repository":{"id":118859512,"uuid":"477767797","full_name":"piriyaraj/QR-Code-Generator","owner":"piriyaraj","description":"QR code generator for the text input using c language. User can able to generate the QR code in different color and different size. fully developed by @piriyaraj","archived":false,"fork":false,"pushed_at":"2022-04-04T16:33:39.000Z","size":260,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T05:44:08.087Z","etag":null,"topics":["clanguage","qrcode-generator"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/piriyaraj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-04T15:46:12.000Z","updated_at":"2022-04-04T16:32:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6fe438a-fb30-4e3d-a250-383171c952d8","html_url":"https://github.com/piriyaraj/QR-Code-Generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piriyaraj%2FQR-Code-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piriyaraj%2FQR-Code-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piriyaraj%2FQR-Code-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piriyaraj%2FQR-Code-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piriyaraj","download_url":"https://codeload.github.com/piriyaraj/QR-Code-Generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243754094,"owners_count":20342542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clanguage","qrcode-generator"],"created_at":"2024-11-21T12:42:37.635Z","updated_at":"2025-03-15T16:11:11.838Z","avatar_url":"https://github.com/piriyaraj.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CO222: Programming Methodology\n\n## Project 1: QR Code Generator - Specification\n\n## Objectives\n\nMaking you familiar with,\n● Arrays\n● Loops\n● Functions\n● Command-line argument handling\n● Debugging\n● Good coding practices\n● Linux\n\n## Introduction\n\nGiven a URL you have to encode it to a QR (Quick Response) Code (According to the given\nalgorithm) and print it on the Linux terminal. You will be given a sample program that would do\nthe same task. Your task is to replicate the functionality of the given program.\n**_The output should print exactly at the same place and scale as the given sample\nprogram._**\nPlease note that all the algorithms which are given are made up algorithms, you cannot reverse\nthe QR to the string by the existing QR scanners.\n\n## Inputs:\n\n**User inputs:**\n● You should get the URL as a user input through STDIN (this string should be greater\nthan 3 characters and less than 120 characters)\n**Command-line arguments:**\n● If a colour is given as an argument to the program with the ‘-c’ flag, the program should\nbe able to print the QR code using the given colour. If no argument is given use black\nand white as default.\n\n\n```\nEg: ./program -c red\nGiven the above arguments, the program should print the QR code in red and white.\nThese colors should be supported by the program - black, red, green, yellow, blue,\nmagenta, cyan\n● If -h flag is given or the given arguments are invalid, you should print the usages of your\nprogram (how the arguments should be given). See the sample binary given for the\nexpected behaviour.\n```\n## Output:\n\nPrint the relevant QR code in the terminal. Consider the length of the string and choose to which\nversion the string should be encoded. If the input string is less than or equal 20 characters it\nshould be encoded to the smaller version as in the 2nd figure and if the number of characters of\nthe input string is more than 20 it should be encoded to the larger version as in 1st figure.\n\n\n## String Hashing algorithm\n\nTo encode a string to QR code, first, you need to hash the string and convert it to a fixed-length\nstring. For the smaller QR version (Input string length less than or equal 20) you need to hash\nthe string to 24 characters and for the larger version(Input string greater than 20) you need to\nhash the string to 132 characters. Follow the below steps to get the hashed string.\nThe ASCII value of the first character of the hashed string = Length of the input string + 50\n(which is used for decoding purposes).\nAssume the length of the input string is L. Then, the next L characters of the hashed string\nshould be the characters of the input string. To fill the remaining characters (this part of the\nstring is used for error detection), add 1 to the ASCII values of characters in the input string and\nappend them to the string until you reach the required length. Do this by incrementing the\nnumber you are adding by 1 in each round until all the required number of characters is\nobtained. Then reverse the error detection part of the hashed string.\nObserve the given example:\nInput string: ABCDEFGH\nFirst character = 50 + 8\n\n\n## QR generation algorithm\n\nEach QR Code has 3 Position identification squares (6x6 unit squares) in 3 corners. They\nshould be drawn in the pattern given below:\nThe remaining area is for character encoding, which is divided into small squares. (of size 3x\nunit squares each).\nEach small square represents one character of the hashed string. Figures below represent\nwhich character should be encoded within each square in the 2 different versions.\nThe QR has a white border(of width 1 unit square) for clarity, observe the outputs of the sample\nprogram and implement the exact same thing. Considering scale position and color.\n\n\n● The small version - for string length 20 or less (First get the hashed string of length 24)\n● The larger version - for string length above 20 (first obtain the hashed string of length\n132)\n\n\nAfter finding the relevant character of the square, to encode it you should get the ASCII value of\nthe character and then get the binary representation using 9 bits. Then colour each unit square\nof the 3x3 square according to the value of the corresponding bit. Black if the value is 1 and\nwhite otherwise. (Consider MSB as b1 and LSB as b9)\nEg ‘W’ ASCII value = 87 Binary representation: 001010111\nThe encoded pattern for W:\n\n## Problem breakdown\n\nInstead of directly going to code the solution, you must break down the problem into smaller\nsubproblems, such as\n\n1. How to get user input\n2. How to hash the string to a fixed-length\n3. How to print basic frame and position identification squares\n4. How to print the encoded pattern of one character\n5. How to print multiple patterns in different positions of the console.\n6. How to assign a color when printing\n7. Error handling and the argument handling\nInstead of thinking about the problem as a whole, try and find the solutions for each one of the\nabove questions. That will help you to reach the final goal smoothly and accumulatively.\n\n## Important\n\n```\n● Pay attention to boundary cases and handle the errors correctly.\n● Refer ANSI escape codes which will be useful to complete this project.\n● Under no circumstance, you should copy somebody else’s code. Copying someone\nelse’s code (including your group mate’s) or showing your source code to anyone else\nwill earn you zero mark for the whole project. You might need to be really careful\nbecause this has happened many times in the past. Therefore, put some honest effort to\nearn the marks for project 1.\n● Basic functionality, functionality with colors, error handling, modularization (functions)\nand good coding practices will be considered when marking.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiriyaraj%2Fqr-code-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiriyaraj%2Fqr-code-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiriyaraj%2Fqr-code-generator/lists"}